Doloro GDK 22 .1.0 Beta
by Tauri Interactive
Color Palettes

About

The UI Engine 2 module that allow runtime control over the UI elements' color without demands to anyhow address each element impersonally. By using the module features you may manage entire GUI palette for GUI elements bonded with the module just with simple commands via API.

Technical introduction

The module supports 2 palettes to be used at the same time.
The system declares them as Main and Alternative. Each palette contains 5 colors: background, background2, foreground, hover, selection.

  • Entire manual operations with the pallets going via PaletteHandler service that encapsulates instances update.
  • Palettes declaration goes via creation of from a ColorPalette asset. Read more: Palette creation.

Module integration is very easy and shorten to user for only 3 important classes to use.

Class Purpose
Doloro.UIEngine2.Modules.Palettes.PaletteHandler Static API service to resources management. Using for any operations with palettes other that defaults loading going automatically.
Doloro.UIEngine2.Modules.Palettes.PaletteColorPicker Component that bond graphic with the module's backstage. Allows to defined paired color source to the GUI element.
Doloro.UIEngine2.Modules.Palettes.ColorPalette Resource asset that declares and configures palette settings.
Warning
To be auto detected and loaded to the service resources must be located at the Resources\palettes folder.

How to setup

Palette creation

  1. Press LMB on Project panel
  2. Select Create\Color Palette (DoloroUI2) in context menu.
  3. Place created asset in sub-directory Resources\palettes to make it visible for PaletteHandler service.
  4. Open resource in inspector and define colors according with its pallet position.


Palette creation

For bond of a GUI element to the module you have to put the PaletteColorPicker component to a destination game object with an Image or Renderer component.

In case of Renderer attachment the picker will apply a bond palette color to the Renderer.color property.


Default palettes

You may define default palettes to load. They will apply to PaletteHandler service during its loading.
To setup default palettes you have to name target ColorPalette resources according with the next pattern:

Name Purpose
default_main Declares palette resource as the default source for main palette.
default_alt Declares palette resource as the default source for alternative palette.

Main or Alternative palette selecting on PaletteColorPicker component as a source to apply.