From 6769a236f106eb35a93fd6a50ac3992b6d79937f Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Thu, 18 May 2023 16:45:33 -0500 Subject: [PATCH] Make planar foreground colors different from bought color --- src/data/planes.tsx | 8 ++++---- src/data/utils.tsx | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/data/planes.tsx b/src/data/planes.tsx index 6895b80..f665b74 100644 --- a/src/data/planes.tsx +++ b/src/data/planes.tsx @@ -96,7 +96,7 @@ export function createPlane( for (let i = 0; i < 12; i++) random(); const name = getName(random); - const color = getColor([0.64, 0.75, 0.55], random); + const color = getColor([0.56, 0.74, 0.73], random); const background = getColor([0.18, 0.2, 0.25], random); const resource = createResource(0, getName(random)); const timeActive = persistent(0); @@ -487,7 +487,7 @@ export function createPlane( break; case "conversion": { const prestigeResource = createResource(0, getName(random)); - const prestigeColor = getColor([0.64, 0.75, 0.55], random); + const prestigeColor = getColor([0.56, 0.74, 0.73], random); const cost = nextCost.value; const costExponent = random() / 2 + 0.25; // Random from 0.25 - 0.75 const effectExponent = random() / 2 + 0.25; // ditto @@ -660,7 +660,7 @@ export function createPlane( ); previousGain = costFormula.evaluate(); n.value += 2; - const barColor = getColor([0.64, 0.75, 0.55], random); + const barColor = getColor([0.56, 0.74, 0.73], random); const bar = createBar(() => ({ direction: Direction.Right, width: 300, @@ -719,7 +719,7 @@ export function createPlane( case "dimensions": { const title = getPowerName(random); const energy = createResource(0, title + " energy"); - const energyColor = getColor([0.64, 0.75, 0.55], random); + const energyColor = getColor([0.56, 0.74, 0.73], random); const currentN = n.value; const prevGain = previousGain; costFormula = costFormula.add( diff --git a/src/data/utils.tsx b/src/data/utils.tsx index e7f5447..054d37c 100644 --- a/src/data/utils.tsx +++ b/src/data/utils.tsx @@ -329,7 +329,11 @@ export function getPowerName(random: () => number) { export function getColor(base: [number, number, number], random: () => number) { const [h, s, v] = rgb2hsv(...base); - const [r, g, b] = hsv2rgb(Math.floor(random() * 360), s, v); + let newH = Math.floor(random() * 320); + if (newH > h - 20) { + newH += 40; + } + const [r, g, b] = hsv2rgb(newH, s, v); return `rgb(${r * 255}, ${g * 255}, ${b * 255})`; }