psychopy.colors
- For working with colors¶Classes and functions for working with colors.
|
A class to store color details, knows what colour space it's in and can supply colours in any space. |
|
Depreciated as of 2021.0 |
|
Depreciated as of 2021.0 |
A class to store color details, knows what colour space it’s in and can supply colours in any space.
color (ArrayLike or None) – Color values (coordinates). Value must be in a format applicable to the specified space.
space (str or None) – Colorspace to interpret the value of color as being within.
contrast (int or float) – Factor to modulate the contrast of the color.
conematrix (ArrayLike or None) – Cone matrix for colorspaces which require it. Must be a 3x3 array.
How opaque (1) or transparent (0) this color is. Synonymous with opacity.
Color value expressed as a DKL triplet.
Color value expressed as a cartesian DKL triplet.
Color value expressed as a DKL triplet, with alpha value (0 to 1).
Color value expressed as a cartesian DKL triplet, with alpha value (0 to 1).
Get a color which will stand out and be easily readable against this one. Useful for choosing text colors based on background color.
contrast (float) – Desired perceived contrast between the two colors, between 0 (the same color) and 1 (as opposite as possible). Default is the w3c recommended minimum of 4.5/21 (dividing by 21 to adjust for sRGB units).
A contrasting color to this color.
Color value expressed as a hex string. Can be a ‘#’ followed by 6 values from 0 to F (e.g. #F2545B).
Color value expressed as an HSV triplet.
Color value expressed as an HSV triplet, with alpha value (0 to 1).
Color value expressed as an LMS triplet.
Color value expressed as an LMS triplet, with alpha value (0 to 1).
The name of this color, if it has one (str).
How opaque (1) or transparent (0) this color is (float). Synonymous with alpha.
Apply contrast to the base color value and return the adjusted color value.
Color value expressed as an RGB triplet from -1 to 1.
Color value expressed as an RGB triplet from 0 to 1.
Color value expressed as an RGB triplet from 0 to 255.
Color value expressed as an RGB triplet from -1 to 1, with alpha values (0 to 1).
Color value expressed as an RGB triplet from 0 to 1, with alpha value (0 to 1).
Color value expressed as an RGB triplet from 0 to 255, with alpha value (0 to 1).
Set the colour of this object - essentially the same as what happens on creation, but without having to initialise a new object.
Color value expressed as an sRGB triplet