Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Darker ¶
Darker returns a tone less than or equal to the given tone that satisfies the specified contrast ratio.
The returned value is in the range [0, 100]. Returns -1 if the desired contrast ratio cannot be achieved with the input tone.
tone must be in the range [0, 100]. Invalid values result in -1. ratio should be in the range [1, 21]; invalid values have undefined behavior.
func DarkerUnsafe ¶
DarkerUnsafe returns a tone less than or equal to the given tone that attempts to satisfy the specified contrast ratio.
The returned value is always in the range [0, 100]. Returns 0 if the desired contrast ratio cannot be achieved. Unlike Darker, this function does not fail but may not always satisfy the desired contrast ratio.
func Lighter ¶
Lighter returns a tone greater than or equal to the given tone that satisfies the specified contrast ratio.
The returned value is in the range [0, 100]. Returns -1 if the desired contrast ratio cannot be achieved with the input tone.
tone must be in the range [0, 100]. Invalid values result in -1. ratio should be in the range [1, 21]; invalid values have undefined behavior.
func LighterUnsafe ¶
LighterUnsafe returns a tone greater than or equal to the given tone that attempts to satisfy the specified contrast ratio.
The returned value is always in the range [0, 100]. Returns 100 if the desired contrast ratio cannot be achieved. Unlike Lighter, this function does not fail but may not always satisfy the desired contrast ratio.
func RatioOfTones ¶
RatioOfTones returns the contrast ratio between two tones, in the range [1, 21].
toneA and toneB should be values between 0 and 100. Values outside this range will be clamped internally.
Types ¶
This section is empty.