# \[ControlP5\] change button text color

**URL:** <https://discourse.processing.org/t/controlp5-change-button-text-color/45008>\
**Category:** Libraries\
**Created:** [August 29, 2024, 3:20pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008 "2024-08-29T15:20:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabit](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@fabit](https://discourse.processing.org/u/fabit)\
**Post date:** [August 29, 2024, 3:20pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/1 "2024-08-29T15:20:39Z")

</div>

Hi everyone!

I am trying to design buttons with different colors but i don’t know how to change the color of name button inside it.Normally the color is white and every sketch i see online uses this color.Can i add something to the code for doing this thing?

This is the classic code i wrote:

```auto
import controlP5.*; //import ControlP5 library
import processing.serial.*;

Serial port;

ControlP5 cp5; //create ControlP5 object
PFont font;

void setup(){ //same as arduino program

  size(1366, 768); //window size, (width, height)
  
  printArray(Serial.list()); //prints all available serial ports
  
  //port = new Serial(this, "COM3", 9600); //i have connected arduino to com3, it would be different in linux and mac os
  
  //lets add button to empty window
  
  cp5 = new ControlP5(this);
  font = createFont("arial", 20); // custom fonts for buttons and title
  
  cp5.addButton("rosso") //"red" is the name of button
    .setPosition(100, 50) //x and y coordinates of upper left corner of button
    .setSize(100, 70) //(width, height)
    .setFont(font)
    .setColorBackground(color(255, 0, 0))
  ;

```

 ![Senza titolo](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/8/5/85468e890cc5fd7af0824dea4a3835ac7fdd0d62.png)

Thanks for your help

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [August 29, 2024, 4:12pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/2 "2024-08-29T16:12:47Z")

</div>

Try:  
` .setColorCaptionLabel(color(0,0,0))`

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [August 29, 2024, 4:24pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/3 "2024-08-29T16:24:21Z")

</div>

Welcome to the forum.

I have moved this discussion to the ‘Libraries’ section because the question is about using the ControlP5 library not about _using_ Arduino.

---

<div class="post-metadata">

**Author:** ![fabit](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@fabit](https://discourse.processing.org/u/fabit)\
**Post date:** [August 29, 2024, 4:29pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/4 "2024-08-29T16:29:59Z")

</div>

I tried using this and it works.Thank you so much.Where can i find these instruction?Are they in the library o in processing?

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [August 29, 2024, 4:54pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/5 "2024-08-29T16:54:57Z")

</div>

> [@fabit](#):
>
> .Where can i find these instruction?

Look in Examples/Contributed Libraries/ControlP5/ControlP5button and scroll all the way to the bottom.

---

<div class="post-metadata">

**Author:** ![fabit](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@fabit](https://discourse.processing.org/u/fabit)\
**Post date:** [August 29, 2024, 5:06pm UTC](https://discourse.processing.org/t/controlp5-change-button-text-color/45008/6 "2024-08-29T17:06:50Z")

</div>

Perfect,thank you for your help
