Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Darker ¶
Darker finds a darker tone meeting the specified contrast ratio.
Params:
- tone: Base tone value (0-100).
- ratio: Desired contrast ratio (1-21).
Returns float64 - Darker tone in [0,100]. Returns -1 if ratio cannot be met.
func DarkerUnsafe ¶
DarkerUnsafe finds a darker tone attempting to meet contrast ratio.
Unlike Darker, always returns a valid tone even if ratio cannot be met. Params:
- tone: Base tone value (0-100).
- ratio: Desired contrast ratio (1-21).
Returns float64 - Darker tone in [0,100]. Returns 0 if ratio cannot be met.
func Lighter ¶
Lighter finds a lighter tone meeting the specified contrast ratio.
Params:
- tone: Base tone value (0-100).
- ratio: Desired contrast ratio (1-21).
Returns float64 - Lighter tone in [0,100]. Returns -1 if ratio cannot be met.
func LighterUnsafe ¶
LighterUnsafe finds a lighter tone attempting to meet contrast ratio.
Unlike Lighter, always returns a valid tone even if ratio cannot be met. Params:
- tone: Base tone value (0-100).
- ratio: Desired contrast ratio (1-21).
Returns float64 - Lighter tone in [0,100]. Returns 100 if ratio cannot be met.
func RatioOfTones ¶
RatioOfTones calculates the contrast ratio between two tones.
Params:
- toneA: First tone value (0-100).
- toneB: Second tone value (0-100).
Returns float64 - Contrast ratio in range [1, 21]. Values outside [0,100] are clamped.
Types ¶
This section is empty.