Created
October 4, 2023 19:28
-
-
Save wchargin/18929216039b2028e6148c67d4a73ac4 to your computer and use it in GitHub Desktop.
color bullseyes by ring count in qqlrs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/art.rs b/src/art.rs | |
index 953bf99..ffec2d1 100644 | |
--- a/src/art.rs | |
+++ b/src/art.rs | |
@@ -1431,14 +1431,21 @@ fn draw_ring_dot(pt: &Point, pctx: &mut PaintCtx, rng: &mut Rng) { | |
variance_adjust * rescale(num_rings as f64, (1.0, 7.0), (0.022, 0.008)) | |
}; | |
+ // https://personal.sron.nl/~pault/ | |
+ const SEQ: [Rgb; 7] = [ | |
+ Rgb(68.0, 119.0, 170.0), | |
+ Rgb(102.0, 204.0, 238.0), | |
+ Rgb(34.0, 136.0, 51.0), | |
+ Rgb(204.0, 187.0, 68.0), | |
+ Rgb(238.0, 102.0, 119.0), | |
+ Rgb(170.0, 51.0, 119.0), | |
+ Rgb(187.0, 187.0, 187.0), | |
+ ]; | |
+ | |
let mut band_num = 0; | |
let mut r = pt.scale; | |
while r > w(0.0004) { | |
- let color = if band_num % 2 == 0 { | |
- pt.primary_color | |
- } else { | |
- pt.secondary_color | |
- }; | |
+ let source = SEQ[num_rings as usize - 1].to_source(); | |
band_num += 1; | |
let band_center_x = rng.gauss(pt.position.0, w(0.0005).min(r * position_variance)); | |
@@ -1463,7 +1470,7 @@ fn draw_ring_dot(pt: &Point, pctx: &mut PaintCtx, rng: &mut Rng) { | |
r, | |
final_thickness, | |
variance_adjust, | |
- color, | |
+ source, | |
pctx, | |
rng, | |
); | |
@@ -1477,12 +1484,10 @@ fn draw_messy_circle( | |
r: f64, | |
thickness: f64, | |
variance_adjust: f64, | |
- color: Hsb, | |
+ source: Source, | |
pctx: &mut PaintCtx, | |
rng: &mut Rng, | |
) { | |
- let source = color.to_rgb().to_source(); | |
- | |
let num_rounds_divisor = if thickness > w(0.02) { | |
rescale(thickness, (w(0.02), w(0.04)), (w(0.00021), w(0.00022))) | |
} else if thickness > w(0.006) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment