Skip to main content

Crate use_modular_scale

Crate use_modular_scale 

Source
Expand description

Primitive modular typography scale helpers.

These helpers keep common scale ratios explicit and deterministic.

§Examples

use use_modular_scale::{ScaleRatio, modular_scale, scale_down, scale_up};

let values = modular_scale(16.0, ScaleRatio::MajorThird, -1, 1).unwrap();

assert!((scale_up(16.0, ScaleRatio::MajorThird, 1).unwrap() - 20.0).abs() < 1.0e-12);
assert!((scale_down(16.0, ScaleRatio::MajorThird, 1).unwrap() - 12.8).abs() < 1.0e-12);
assert_eq!(values.len(), 3);

Enums§

ModularScaleError
ScaleRatio

Functions§

modular_scale
scale_down
scale_up