Skip to content

Commit

Permalink
More color functions fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ committed Sep 4, 2024
1 parent e5937a2 commit 33f4a4e
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions docs/user_manual/expressions/expression_help/Color.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,18 @@ Returns a color object based on its cyan, magenta, yellow, black and alpha compo
color_grayscale_average
.......................

Applies a grayscale filter and returns a string representation from a provided color.
Applies a grayscale filter to a color and returns it. Returned type is the same as color argument, i.e. a color string representation or a color object.

.. list-table::
:widths: 15 85

* - Syntax
- color_grayscale_average(color)
* - Arguments
- * **color** - a color string
- * **color** - a color string representation or a color object
* - Examples
- * ``color_grayscale_average('255,100,50')`` → '135,135,135,255'
* ``color_grayscale_average(color_cmykf(0.6,0.5,0.1,0.8))`` → CMYKA: 0.40,0.40,0.40,0.80,1.00


.. end_color_grayscale_average_section
Expand Down Expand Up @@ -239,6 +240,29 @@ Returns a color object based on its hue, saturation, and value attributes.

.. end_color_hsvf_section
.. _expression_function_Color_color_mix:

color_mix
.........

Returns a color mixing the red, green, blue, and alpha values of two provided colors based on a given ratio. Returned type is the same as color arguments, i.e. a color string representation or a color object.

.. list-table::
:widths: 15 85

* - Syntax
- color_mix(color1, color2, ratio)
* - Arguments
- * **color1** - a color string or a color object
* **color2** - a color string or a color object
* **ratio** - a ratio
* - Examples
- * ``color_mix_rgb('0,0,0','255,255,255',0.5)`` → '127,127,127,255'
* ``color_mix(color_cmykf(0.9,0.9,0.9,0.9),color_cmykf(0.1,0.1,0.1,0.1),0.5)`` → CMYKA: 0.50,0.50,0.50,0.50,1.00


.. end_color_mix_section
.. _expression_function_Color_color_mix_rgb:

color_mix_rgb
Expand Down Expand Up @@ -266,15 +290,15 @@ Returns a string representing a color mixing the red, green, blue, and alpha val
color_part
..........

Returns a specific component from a color string, e.g., the red component or alpha component.
Returns a specific component from a color string or color object, e.g., the red component or alpha component.

.. list-table::
:widths: 15 85

* - Syntax
- color_part(color, component)
* - Arguments
- * **color** - a color string
- * **color** - a color string or a color object
* **component** - a string corresponding to the color component to return. Valid options are:


Expand All @@ -297,6 +321,7 @@ Returns a specific component from a color string, e.g., the red component or alp

* - Examples
- * ``color_part('200,10,30','green')`` → 10
* ``to_int(color_part(color_cmykf(0.1,0.2,0.3,0.9),'black'))`` → 90


.. end_color_part_section
Expand Down Expand Up @@ -399,15 +424,15 @@ Returns a gradient ramp from a map of color strings and steps.
darker
......

Returns a darker (or lighter) color string
Returns a darker (or lighter) color. Returned type is the same as color arguments, i.e. a color string representation or a color object.

.. list-table::
:widths: 15 85

* - Syntax
- darker(color, factor)
* - Arguments
- * **color** - a color string
- * **color** - a color string or a color object
* **factor** - an integer corresponding to the darkening factor:

* if the factor is greater than 100, this function returns a darker color (e.g., setting factor to 200 returns a color that is half the brightness);
Expand All @@ -426,15 +451,15 @@ Returns a darker (or lighter) color string
lighter
.......

Returns a lighter (or darker) color string
Returns a lighter (or darker) color. Returned type is the same as color arguments, i.e. a color string representation or a color object.

.. list-table::
:widths: 15 85

* - Syntax
- lighter(color, factor)
* - Arguments
- * **color** - a color string
- * **color** - a color string or a color object
* **factor** - an integer corresponding to the lightening factor:

* if the factor is greater than 100, this function returns a lighter color (e.g., setting factor to 150 returns a color that is 50% brighter);
Expand Down Expand Up @@ -516,15 +541,15 @@ Returns a string representing a color from an expression-created ramp
set_color_part
..............

Sets a specific color component for a color string, e.g., the red component or alpha component.
Sets a specific color component for a color string or a color object, e.g., the red component or alpha component.

.. list-table::
:widths: 15 85

* - Syntax
- set_color_part(color, component, value)
* - Arguments
- * **color** - a color string
- * **color** - a color string or a color object
* **component** - a string corresponding to the color component to set. Valid options are:


Expand All @@ -548,6 +573,7 @@ Sets a specific color component for a color string, e.g., the red component or a
* **value** - new value for color component, respecting the ranges listed above
* - Examples
- * ``set_color_part('200,10,30','green',50)`` → '200,50,30,255'
* ``set_color_part(color_cmykf(0.21,0,0.92,0.70),'black',100)`` → CMYKA: 0.21,0.00,0.92,1.00,1.00


.. end_set_color_part_section
Expand Down

0 comments on commit 33f4a4e

Please sign in to comment.