Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Darker ¶
Darker returns a tone darker than the given tone and that meets the specified contrast ratio. The tone must be in the range [0, 100] and ratio must be in the range [1, 21]. It returns -1 if the ratio cannot be met.
func DarkerUnsafe ¶
DarkerUnsafe is like Darker but always returns a valid tone even if the ratio cannot be met. If the ratio cannot be met, it returns 0.
func Lighter ¶
Lighter returns a tone lighter than the given tone and that meets the specified contrast ratio. The tone must be in the range [0, 100] and ratio must be in the range [1, 21]. It returns -1 if the ratio cannot be met.
func LighterUnsafe ¶
LighterUnsafe is like Lighter but always returns a valid tone even if the ratio cannot be met. If the ratio cannot be met, it returns 100.
func RatioOfTones ¶
RatioOfTones calculates the contrast ratio between two tones. toneA and toneB should be in the range [0, 100]. Values outside this range are clamped. The return value is the contrast ratio in the range [1, 21].
Types ¶
This section is empty.