HCT is a color model developed by [Google][material-hct]. It aims to solve a problem related to generating color palettes with good contrast. While HCT may seem like a revolutionary color model, the idea behind it is quite simple, take the perceptually uniform color model CAM16 and combine it with the CIE Lab's lightness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from coloraide import Color as Base | |
| class Color(Base): | |
| FIT = 'oklch-chroma' | |
| POWERLESS = True | |
| CARRYFORWARD = True | |
| print('==== Case 1 ====') | |
| color = Color.interpolate(['oklch(100% 50% 60deg)', 'oklch(50% 50% 0deg)'], space='oklch', out_space='oklch')(0.5) | |
| Row([color.to_string(percent=True), color.convert('srgb').to_string()]) |
/// tab | Tab 1
//// tab | Tab A content ////
//// tab | Tab B content //// ///
DPS Contrast, also known as Delta Phi Star, is a simple formula for predicting human visual perception of contrast between text and background.
-
WHAT WHERE HOW
- Delta Phi Star predicts the contrast of text against the background for a given pair of colors.
- Delta Phi Star emerged from the SAPC/APCA project developing new standards for better beat ability on the web.
- Delta Phi Star takes in two
$L^*$ (Lstar) values, and returns an$L^c$ (lightness contrast) value.
-
UNIFORMITY:
-
DPS Contrast is quasi-uniform for human perception of text against a background on a self-illuminated display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pragma: init | |
| """Custom sRGB color class.""" | |
| from coloraide import Color as Base | |
| from coloraide.spaces.srgb.css import sRGB | |
| from coloraide.css import serialize | |
| from coloraide import algebra as alg | |
| import re | |
| RE_CUSTOM = re.compile(r'(?i)\b([a-z][a-z_]{2,})\b') |
"""XYB color space."""
from __future__ import annotations
from coloraide import algebra as alg
from coloraide.spaces import Space
from coloraide.types import Vector
from coloraide.cat import WHITES
from coloraide.channels import Channel, FLG_MIRROR_PERCENT
from coloraide import Color as Base
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"data":[{"facecolor":["rgb(111, 243, 0)","rgb(118, 243, 0)","rgb(117, 241, 0)","rgb(110, 241, 0)","rgb(112, 246, 0)","rgb(113, 249, 0)","rgb(113, 249, 0)","rgb(122, 251, 0)","rgb(255, 221, 129)","rgb(255, 224, 127)","rgb(108, 238, 0)","rgb(108, 238, 0)","rgb(114, 236, 0)","rgb(108, 238, 0)","rgb(114, 236, 0)","rgb(106, 233, 0)","rgb(100, 73, 0)","rgb(100, 76, 0)","rgb(195, 142, 0)","rgb(195, 148, 0)","rgb(197, 149, 0)","rgb(195, 142, 0)","rgb(197, 149, 0)","rgb(200, 145, 0)","rgb(255, 221, 186)","rgb(255, 222, 183)","rgb(255, 255, 255)","rgb(255, 254, 252)","rgb(161, 49, 0)","rgb(159, 48, 0)","rgb(144, 48, 0)","rgb(141, 47, 0)","rgb(146, 53, 0)","rgb(144, 48, 0)","rgb(5, 2, 0)","rgb(5, 2, 0)","rgb(255, 227, 209)","rgb(255, 224, 206)","rgb(255, 255, 255)","rgb(255, 254, 252)","rgb(255, 231, 140)","rgb(255, 231, 140)","rgb(255, 221, 132)","rgb(255, 221, 132)","rgb(255, 221, 132)","rgb(255, 225, 132)","rgb(255, 228, 155)","rgb(255, 227, 152)","rgb(255, 226, 135)","rgb(255, 226, 137)","rgb(255, 251, 247)","rgb(2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pragma: init | |
| """ | |
| Okhsl/Okhsv class. | |
| Adapted to Python and ColorAide and adjusted to P3 by Isaac Muse 2023. | |
| ---- License ---- | |
| Copyright (c) 2021 Björn Ottosson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pragma: init | |
| from coloraide import Color as Base | |
| from coloraide.cat import WHITES | |
| from coloraide.spaces import Space | |
| from coloraide import algebra as alg | |
| from coloraide.types import Vector | |
| from coloraide.channels import Channel | |
| from coloraide import Color as Base | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pragma: init | |
| """Convert Linear sRGB to LMS using Smith & Pokorny (1975) 2-deg cone fundamentals.""" | |
| from __future__ import annotations | |
| from coloraide.cat import WHITES | |
| from coloraide.spaces import Space | |
| from coloraide import algebra as alg | |
| from coloraide.types import Vector | |
| from coloraide.channels import Channel | |
| LRGB_TO_LMS = [ |