Class ColorOps
Version added: 11.0
The ColorOps class provides a collection of utility functions for creating, converting, and manipulating colors within Moho.
It allows scripts to blend, invert, compare, and convert colors between RGB and HSV color spaces.
These methods are commonly used in custom tools, effects, and UI scripts that require dynamic color adjustments or color-based calculations.
NOTE: All methods and properties of this class are static (which means they can be used without creating an instance of the class).
For example:
or
It allows scripts to blend, invert, compare, and convert colors between RGB and HSV color spaces.
These methods are commonly used in custom tools, effects, and UI scripts that require dynamic color adjustments or color-based calculations.
NOTE: All methods and properties of this class are static (which means they can be used without creating an instance of the class).
For example:
local rgbCol = LM.ColorOps:RgbColor(10, 20, 30, 40)or
local rgbCol = LM.ColorOps.RedMethods of ColorOps:
| Name | Returns | Description | Ver |
| BlendColors BlendColors(percent, color1, color2) | rgb_color | Blends two colors together based on the specified percentage | 11.0 |
| Hsv2Rgb Hsv2Rgb(col) | rgb_color | Converts a color from HSV space to RGB space | 11.0 |
| HsvColor HsvColor(h, s, v, a) | hsv_color | Creates a new HSV color object from the given hue, saturation, value, and alpha components | 11.0 |
| InvertColor InvertColor(r, g, b, a) | rgb_color | Generates an inverted version of an RGBA color | 11.0 |
| Rgb2Hsv Rgb2Hsv(col) | hsv_color | Converts a color from RGB space to HSV space | 11.0 |
| RgbColor RgbColor(r, g, b, a) | rgb_color | Creates a new RGBA color object from numeric component values | 11.0 |
| SameColor SameColor(lColor, rColor) | bool | Checks whether two color objects are identical | 11.0 |
Properties of ColorOps:
| Name | Type | Description | Ver |
| Black | rgb_color | RGBA (0, 0, 0, 255) | 11.0 |
| Blue | rgb_color | RGBA (0, 0, 255, 255) | 11.0 |
| Clear | rgb_color | RGBA (0, 0, 0, 0) | 11.0 |
| Cyan | rgb_color | RGBA (0, 255, 255, 255) | 11.0 |
| Green | rgb_color | RGBA (0, 255, 0, 255) | 11.0 |
| Magenta | rgb_color | RGBA (255, 0, 255, 255) | 11.0 |
| Red | rgb_color | RGBA (255, 0, 0, 255) | 11.0 |
| White | rgb_color | RGBA (255, 255, 255, 255) | 11.0 |
| Yellow | rgb_color | RGBA (255, 255, 0, 255) | 11.0 |