Allow more variation in the cover profiles
- ID
30878bb- date
2025-01-29 20:58:14+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
c372016- message
Allow more variation in the cover profiles- changed files
2 files, 8 additions, 8 deletions
Changed files
static/app.js (14721 → 14757)
diff --git a/static/app.js b/static/app.js
index 08976bb..c395ad3 100644
--- a/static/app.js
+++ b/static/app.js
@@ -184,8 +184,8 @@ function chooseColour(fandom) {
// The saturation/lightness values are chosen to get a dark-ish
// shade that will look good with white text.
- const saturation = 1.0;
- const lightness = 0.25;
+ const saturation = 0.7 + 0.3 * getRand();
+ const lightness = 0.15 + 0.2 * getRand();
// Convert to rgb.
let [red, green, blue] = hslToRgb(hue, saturation, lightness);
test/app.js (1853 → 1853)
diff --git a/test/app.js b/test/app.js
index 847c32f..9c3e8f8 100644
--- a/test/app.js
+++ b/test/app.js
@@ -30,18 +30,18 @@ QUnit.module('getKeyFicInfo', () => {
QUnit.module('chooseColour', () => {
QUnit.test('it chooses the colour in a reproducible way', (assert) => {
const fandom = 'Operation Mincemeat: A New Musical - SpitLip';
- assert.equal(chooseColour(fandom), '#00805d');
+ assert.equal(chooseColour(fandom), '#098262');
});
QUnit.test('it chooses different colours for Star Wars and Star Trek', (assert) => {
- assert.equal(chooseColour('Star Wars'), '#580080');
- assert.equal(chooseColour('Star Trek'), '#008051');
+ assert.equal(chooseColour('Star Wars'), '#740ca3');
+ assert.equal(chooseColour('Star Trek'), '#08724b');
});
QUnit.test('it creates the same colour for all Star Trek shows', (assert) => {
- assert.equal(chooseColour('Star Trek'), '#008051');
- assert.equal(chooseColour('Star Trek TOS'), '#008051');
- assert.equal(chooseColour('Star Trek: Lower Decks'), '#008051');
+ assert.equal(chooseColour('Star Trek'), '#08724b');
+ assert.equal(chooseColour('Star Trek TOS'), '#08724b');
+ assert.equal(chooseColour('Star Trek: Lower Decks'), '#08724b');
})
});