Skip to content

Instantly share code, notes, and snippets.

View facelessuser's full-sized avatar
💭
Screaming into the void 😱

Isaac Muse facelessuser

💭
Screaming into the void 😱
View GitHub Profile
@facelessuser
facelessuser / css.py
Created August 23, 2023 16:24
CSS undefined handling
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 //// ///

@facelessuser
facelessuser / LICENSE.md
Created June 30, 2023 15:40
Delta Phi Star

DPS CONTRAST (DELTA PHI STAR) LICENSE

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

@facelessuser
facelessuser / custom_color.py
Created June 23, 2023 19:40
Custom sRGB with special color names
# 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')
@facelessuser
facelessuser / xyb.md
Last active April 14, 2023 16:57
XYB Notes
"""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
@facelessuser
facelessuser / oklab.json
Created April 13, 2023 02:21
Oklab Plotly JSON
This file has been truncated, but you can view the full file.
{"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
@facelessuser
facelessuser / okhsl_p3.py
Last active April 14, 2023 02:40
Okhsl P3
# 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
@facelessuser
facelessuser / confusion.py
Last active March 8, 2023 05:14
Lines of Confusion
# 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
@facelessuser
facelessuser / lms.py
Last active March 6, 2023 05:58
LMS Plugin using Smith & Pokorny (1975) 2-deg cone fundamentals
# 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 = [
@facelessuser
facelessuser / pycon.py
Last active January 25, 2025 00:02
Python Console Execution for SuperFences
"""
Execute Python code in code blocks and construct a interactive Python console output.
This allows you to write code examples, but then execute them, showing the results.
https://github.com/facelessuser/pymdown-extensions/issues/1690
---
MIT License