-
Notifications
You must be signed in to change notification settings - Fork 1
Color Module
As with all other modules, you can access the color module with a simple import DOOR;, but if you only want the color module, it's import DOOR.colors;. The Color Module is comprised of 6 sub-modules:
- Web colors (
door.colors.web) - X11 colors (
door.colors.x11) - Translucent colors (
door.colors.translucent) - Adwaita colors (
door.colors.adwaita) - raylib colors (
door.colors.raylib) - Other colors (
door.colors.other)
All of these modules are just collections of shortcut enums for a raylib Color struct with predefined values using well-known color names that are already familiar to most developers.
The color names found in the Web color sub-module match exactly one for one the names of the W3C specification. However, the names match the D style conventions of enum names being in camelCase. The colors covered are all the basic and extended colors.
The color names found in the X11 color sub-module are taken from the X11 color list, obviously, which has been decades in the making and the names in there don't always make sense. The official list has no consistent naming convention and allows for duplicates with alternate spellings to cover the grey vs gray thing. This is not the case here. There is only one instance of each color and its name follows American spelling if there was a duplicate. The names match the D style conventions of enum names being in camelCase. Also, all colors from this module are prefixed with 'x11'; so to use the color green, you'd type x11Green for example.
These are compile time functions which use the template syntax to return a raylib Color struct with the specified alpha value. For example green with an alpha value of 100% would be greenAlpha!255 (results in rgb values 0,255,0,255) while a blue with an alpha value of 65% would be blueAlpha!165 (results in rgb values 0,0,255,165). The colors offered in this sub-module are, in no particular order, white, black, red, orange, yellow, green, blue, cyan, magenta, brown and purple.
These are mostly enums and aliases that match colours found in Adwaita. The names match the D style conventions of enum names being in camelCase.
Provides an alias for raylib constants that are shorter to type. The colour names are all identical but instead of having to type Colors.ColorName, you only have to prefix the name of the color with an r; rColorName.
QT, SFML and EFL are covered in the Other module where type the full colour's name using PascalCase and prefix it with lowercase qt, sf and efl respectively.