跳转至

tkintertools.color.hsl

字数 139 个   代码 42 行   阅读时间 1 分钟   访问量

Support for HSL

🔵blend

function public

1
2
3
4
5
def blend(
    colors: list[tuple[float, float, float]],
    *,
    weights: list[tuple] | None = None,
) -> tuple[float, float, float]: ...

Mix colors by weight

  • colors: color list
  • weights: weight list

🔵contrast

function public

1
2
3
4
5
def contrast(
    hsl: tuple[float, float, float],
    *,
    channels: tuple[bool, bool, bool] = (True, True, True),
) -> tuple[float, float, float]: ...

Get a contrasting color of a color

  • hsl: a tuple, HSL codes
  • channels: three color channels

🔵convert

function public

1
2
3
4
5
6
7
def convert(
    first: tuple[float, float, float],
    second: tuple[float, float, float],
    rate: float,
    *,
    channels: tuple[bool, bool, bool] = (True, True, True),
) -> tuple[float, float, float]: ...

Convert one color to another proportionally

  • first: first color
  • second: second color
  • rate: conversion rate
  • channels: three color channels

🔵gradient

function public

1
2
3
4
5
6
7
8
9
def gradient(
    first: tuple[float, float, float],
    second: tuple[float, float, float],
    count: int,
    rate: float = 1,
    *,
    channels: tuple[bool, bool, bool] = (True, True, True),
    contoller: typing.Callable[[float], float] = flat,
) -> list[tuple[float, float, float]]: ...

Get a list of color gradients from one color to another proportionally

  • first: first color
  • second: second color
  • count: number of gradients
  • rate: conversion rate
  • channels: three color channels
  • controller: control function

🔵hsl_to_rgb

function public

1
2
3
def hsl_to_rgb(
    hsl: tuple[float, float, float],
) -> tuple[int, int, int]: ...
Convert HSL to RGB codes

🔵hsl_to_rgb

function public

1
2
3
def hsl_to_rgb(
    hsl: tuple[float, float, float],
) -> tuple[int, int, int]: ...
Convert HSL to RGB codes

🔵rgb_to_hsl

function public

1
2
3
def rgb_to_hsl(
    rgb: tuple[int, int, int],
) -> tuple[float, float, float]: ...
Convert RGB to HSL codes

🔵rgb_to_hsl

function public

1
2
3
def rgb_to_hsl(
    rgb: tuple[int, int, int],
) -> tuple[float, float, float]: ...
Convert RGB to HSL codes

🟣HSL

constant public

HSL: GenericAlias = tuple[float, float, float]

🟣MAX

constant public

MAX: tuple = (
    6.283185307179586, 1, 1,
)