Skip to content

Colors

Tick UI provides helpers for constructing Color values that read cleanly in source. Prefer these to new Color(0.13f, 0.79f, 1.0f) literals throughout the manual examples and Gallery samples.

Helper table

Helper Returns Notes
UI.FromHex(string hex, int alpha = 255) Color Parses the string with ColorUtility.TryParseHtmlString, then overrides the alpha channel with alpha (0–255). Returns Color.magenta if the string does not parse.
UI.FromInt(int r, int g, int b, int a = 255) Color 0–255 ints per channel. Alpha defaults to 255 (fully opaque).

Choose a helper

Each helper suits a different colour source:

  • FromHex: design-tool palettes. CSS-style hex strings copy and paste cleanly between tools and source.
  • FromInt: a 0–255 channel source, such as a CSV import or a colour picker that exposes ints.

Construct a brand colour

Color brand = UI.FromHex("#23C9FF");
Color text  = UI.FromInt(220, 220, 220);

Set a translucent colour

The package ships a WithAlpha extension method on Color in Interlude.Tick.ColorExtensions (Source/Util/ColorExtensions.cs). It returns a copy of the colour with the alpha channel replaced and the RGB channels untouched:

Color brand   = UI.FromHex("#23C9FF");
Color brand50 = brand.WithAlpha(0.5f);

The using Interlude.Tick; directive already in scope for the UI type brings the extension into scope as well. If you prefer not to rely on the extension, set the alpha channel directly:

Color brand   = UI.FromHex("#23C9FF");
Color brand50 = brand;
brand50.a     = 0.5f;

Additional resources

  • Layout: where you'll typically use these helpers.
  • Theming guide: the broader palette workflow.