color.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ---@meta
  2. ---Colors
  3. ---------
  4. -- `#RGB` defines a color in hexadecimal format.
  5. --
  6. -- `#RGBA` defines a color in hexadecimal format and alpha channel.
  7. --
  8. -- `#RRGGBB` defines a color in hexadecimal format.
  9. --
  10. -- `#RRGGBBAA` defines a color in hexadecimal format and alpha channel.
  11. --
  12. -- Named colors are also supported and are equivalent to
  13. -- [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/#named-color).
  14. -- To specify the value of the alpha channel, append `#A` or `#AA` to the end of
  15. -- the color name (e.g. `colorname#08`).
  16. ---@alias mt.ColorString string
  17. -- The raw integer value of an ARGB8 quad: `colorspec = 0xFF00FF00`.
  18. ---@alias mt.ColorInteger integer
  19. ---@class mt.ColorTable
  20. ---@field r number
  21. ---@field g number
  22. ---@field b number
  23. ---@field a number
  24. -- A ColorSpec specifies a 32-bit color. It can be written in any of the following
  25. -- forms:
  26. --
  27. -- * Table form: Each element ranging from 0..255 (a, if absent, defaults to 255):
  28. -- `colorspec = {a=255, r=0, g=255, b=0}`
  29. -- * Numerical form: The raw integer value of an ARGB8 quad.
  30. -- * String form: A ColorString: `colorspec = "green"`
  31. ---@alias mt.ColorSpec mt.ColorTable|mt.ColorString|mt.ColorInteger