Skip to content

SetColor

otvv edited this page Aug 17, 2020 · 1 revision

CWidgets::SetColor

What it does:

This function sets the default color of a ColorPicker or a Label.

Parameters:

This function takes a FGUI::COLOR or 4 std::uint8_t (r, g, b, a) as arguments.

NOTE: You don't need to set the gradient state.

Widgets:

List of widgets that are using this function:

  • ColorPicker
  • Label

Setting up a ColorPicker

Here's how you can set a default color to the ColorPicker:

buildrPattern.Widget(ColorPicker).Title("ColorPicker 1").Font("Tahoma", 12).Position(15, 200).Color(FGUI::COLOR(255, 255, 0)).SpawnIn(Container);

// or

buildrPattern.Widget(ColorPicker).Title("ColorPicker 1").Font("Tahoma", 12).Position(15, 200).Color({ 255, 255, 0 }).SpawnIn(Container);

// or

buildrPattern.Widget(ColorPicker).Title("ColorPicker 1").Font("Tahoma", 12).Position(15, 200).Color(255, 255, 0).SpawnIn(Container);

NOTE: The process is the same for Labels.

NOTE: There's an extra function added into the pattern: Color. As you can see, there's multiple ways you can add a new color. Just pick the one you think looks better.


What's next?

Next you will learn about the AddTab function.