Beatline Color Scheme for Rhythm-Related Applications
This note describes a beatline color scheme for rhythm-related applications. It is automatically calculated by an algorithm to make colors between common beatlines distinguishable, and to make colors of rare beatlines tend to be gray (#888888.) The color of 1/1 beatline is set to a specific color, while you can change it by modifying the hue offset.
The algorithm uses Oklch color space to balance the differences of hue and luminance between different colors.
Theoretically, colors of all possible beatlines can be calculated with this algorithm. However the calculation of the latter colors depends on the former ones, and the time complexity of the calculation of beatline is , i.e. the time complexity of the calculation of up to beatline is . Therefore it is recommended to simply use gray for the beatlines beyond a certain limit.
Below is a preview of beatline rendering. A line width variation is added to make different beatlines more distinguishable.
The algorithm is directly written in this HTML file, you can check it out by using DevTools or downloading this page.