use-modular-scale 0.0.1

Primitive modular-scale helpers
Documentation
  • Coverage
  • 5.26%
    1 out of 19 items documented1 out of 7 items with examples
  • Size
  • Source code size: 6.02 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 390.72 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-typography
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

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);