The color SDK offers various useful helper methods to convert color formats.
Members
-
require("ko/color").scintilla_yellow
-
Note: Scintilla colors are BGR longs.
Methods
-
require("ko/color").BGRToLong(blue, green, red)
-
Convert separate b,g,r values into a long int.
Parameters:
Name Type Description blueLong greenLong redLong Returns:
color value
- Type
- Long
-
require("ko/color").BGRToRGB(value [, green] [, blue])
-
Convert bgr color value (a long, hex string, or separate r,g,b arguments) into a rgb long int.
Parameters:
Name Type Argument Description valueLong | String hex string, or red component if using r,g,b arguments
greenLong <optional>
blueLong <optional>
Returns:
color value
- Type
- Long
-
require("ko/color").create_n_distinct_colors(n, rand)
-
Returns an array of n distinct (and optionally random) colors in integer format: 0x0AF088
The colors generated will be random, if you want the colors to be a consistent order, pass in a 'rand' float between [0..1].
Parameters:
Name Type Description nint The number of colors to create.
randfloat The optional starting random number.
Returns:
of integers.
- Type
- array
-
require("ko/color").hexToLong(hexstring)
-
Converts a hexadecimal string color of the form #ffaabb to a long
Parameters:
Name Type Description hexstringString Returns:
color value
- Type
- Long
-
require("ko/color").isDark(hexstring)
-
Return whether this is a dark color.
Parameters:
Name Type Description hexstringstring Hexadecimal string of the color.
Returns:
- Type
- Boolean
-
require("ko/color").isLight(hexstring)
-
Return whether this is a light color.
Parameters:
Name Type Description hexstringstring Hexadecimal string of the color.
Returns:
- Type
- Boolean
-
require("ko/color").longToHex(color)
-
Converts an integer into hexadecimal string color of the form #ffaabb.
Parameters:
Name Type Description colorLong value
Returns:
hexstring
- Type
- String
-
require("ko/color").RGB(red, green, blue)
-
WARNING: This actually returns a BGR value which works fine for Scintilla, but won't work for most other targets.
Convert separate r,g,b values into a long int.
Parameters:
Name Type Description redLong greenLong blueLong - Deprecated:
-
- since Komodo 9
Returns:
color value
- Type
- Long
-
require("ko/color").RGBToBGR(color [, green] [, blue])
-
Convert rgb color value (a long, hex string, or separate r,g,b arguments) into a bgr long int.
Parameters:
Name Type Argument Description colorLong | String value, hex string, or red component if using r,g,b arguments
greenLong <optional>
blueLong <optional>
Returns:
color value
- Type
- Long
-
require("ko/color").RGBToLong(red, green, blue)
-
Convert separate r,g,b values, or a hex string, into a long int.
Parameters:
Name Type Description redLong greenLong blueLong Returns:
color value
- Type
- Long
-
require("ko/color").StandardizeHexString(hexstring)
-
Parses hex string to a consistent format
Parameters:
Name Type Description hexstringString Returns:
- Type
- String