ColorGroup

From Xojo Documentation

Class (inherits from Object)


New in 2019r3

The ColorGroup class allows you to do dynamic light/dark target color selection.

Properties
UndefinedColorCallback
Methods
AddColor AddNamedColor Name
AddColorPair Mode Values
Enumerations
Modes Platforms
Constructors

Constructor(defaultColor As Color)


Constructor(defaultLightColor As Color, defaultDarkColor As Color)


Constructor(name as String)


Constructor(name as Text)


Shared Methods
NamedColor
Delegates
UndefinedColorDelegate

Notes

Comparisons and Conversions

A ColorGroup can be directly compared to a Color value to determine if they are the same. It's important to remember of course that you can comparing the known color to the color of the ColorGroup at that moment as a ColorGroup can return different colors based upon the state of the device.

If myColorGroup = Color.Blue Then
Canvas1.DrawingColor = Color.Blue
Else
Canvas1.DrawingColor = Color.Red
End If

When you assign a ColorGroup to a Color property or variable, the color you receive the is color at that moment. For example, in a ColorGroup set to dual color, if you ask for the color when the device is in dark mode, you'll get the dark color.

Assigning a color to a ColorGroup assigns it to the Light Color (the default).

You can assign a named color to a ColorGroup by setting the ColorGroup equal to the name:

myColorGroup = "Link"

For macOS and iOS, Apple provides a complete list of valid named colors. These colors will automatically switch between light and dark modes. Apple's Adaptable System Colors will also automatically switch between light and dark modes but the Fixed Colors will not.

When using a name from Apple's documentation, the case must match as well.

See Also

Color data type; UserGuide:iOS Color Groups, UserGuide:Dark Mode topics