Skip to content

File include/brisk/gui/Styles.hpp


TagWithState class

template <PropertyTag Tag> TagWithState

Argument class

template <PropertyTag Tag> Argument

StyleProperty class (Internal::StyleProperty)

StyleProperty

Rules class

Rules

Rule class

Rule

RuleCmpLess class

RuleCmpLess

RuleCmpEq class

RuleCmpEq

contrastRatio function

inline float contrastRatio(ColorF foreground,
                           ColorF background)

Computes the contrast ratio between two colors.

This function calculates the contrast ratio between a foreground and a background color, based on their lightness values. The contrast ratio is used to determine the readability and accessibility of text on a background.

The formula used is: (L1 + 0.05) / (L2 + 0.05), where L1 is the lightness of the lighter color and L2 is the lightness of the darker color.
Param foreground The foreground color.
Param background The background color.
Returns The contrast ratio between the two colors.


textColorFor function

template <typename Fn>
inline auto textColorFor(Fn &&fn,
                         ColorW primary = Palette::white,
                         ColorW secondary = Palette::black)

Creates a function that returns the appropriate text color based on contrast.

This function returns a lambda that, when given a Widget pointer, computes the contrast ratio between the given colors and the result of a provided function fn. The lambda returns the primary color if it has a higher contrast ratio to the computed color, and the secondary color otherwise.
Template param Fn The type of the function provided.
Param fn The function that returns a ColorW based on a Widget.
Param primary The primary text color (default is white).
Param secondary The secondary text color (default is black).
Returns A lambda that takes a Widget* and returns a ColorW (either primary or secondary color).


Universal class (Selectors::Universal)

Universal

Root class (Selectors::Root)

Root

State class (Selectors::State)

State

Type class (Selectors::Type)

Type

IsMenu class (Selectors::IsMenu)

IsMenu

Role class (Selectors::Role)

Role

Id class (Selectors::Id)

Id

Class class (Selectors::Class)

Class

Parent class (Selectors::Parent)

template <Selector Sel> Parent

All class (Selectors::All)

template <Selector... Selectors> All

Any class (Selectors::Any)

template <Selector... Selectors> Any

Not class (Selectors::Not)

template <Selector Sel> Not

Nth class (Selectors::Nth)

Nth

NthLast class (Selectors::NthLast)

NthLast

First class (Selectors::First)

First

Last class (Selectors::Last)

Last

Selector class

Selector

Rules class

Rules

Style class

Style

Stylesheet class

Stylesheet

StyleVariableTag class

template <typename T, uint64_t Id> StyleVariableTag

Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/