gdquest-demos/godot-kickstarter-2019

Add-on: Color palette

Closed this issue · 2 comments

Problem

We're going to have a styleguide with fixed colors, but we don't have a convenient way to assign these colors to icons, bars, text, etc.

This goes for tutorial slideshows made in Godot as well as debug interfaces or tools we might create.

Color palette

  • Palette widget: should generate a list of buttons from a JSON file.
  • Clicking a button should assign the color to the modulate property of the selected node.
  • The individual buttons/swatches in the palette shouldn't return color objects! The idea is to reuse the components for other tools, e.g. a RichTextLabel editor, where the color will be a string in bbcode tags. Each button should only return a hex color string!
  • The color palette should only be a widget! We should put multiple widgets in a single docker.

NB: No need to support RGBA values, only hex. Note in Godot the hex format is AARRGGBB or RRGGBB: alpha comes first.

Interface

I prepared some UI prototype, see the attached zip : ColorPalette.zip

One gridcontainer per palette section/category. Keep it this simple: no need for a fluid layout or foldable categories. We're only going to have a handful of swatches to start with, making an elaborate UI would be a waste of time at this point.

Krita's palette docker is a good reference for the layout: simple and efficient.

screenshot from 2019-02-05 11-00-47

"palette_name" : {
    "category_name": [
        "color_uid" : "ffffff",
        "color_uid" : "000000"
    ]
}

The color palette should only be a widget! We should put multiple widgets in a single docker.

I didn't get this part. We can display multiple palettes at the same time inside, let's say, a PaletteContainer? Or will we be able, as seems to be in the reference, load a palette at time and then have a menu to select which palette the widget must display?

No, what I meant is that the palette component should be decoupled from everything else in the plugin, like any UI component. Among other things, it shouldn't be bound to the modulate property: a palette should only be a set of buttons that represent and return colors when they're pressed. Then another system takes care of applying the color to a node.

You can put your WIP for review if you want.