diff --git a/src/cubing/puzzle-geometry/PuzzleGeometry.ts b/src/cubing/puzzle-geometry/PuzzleGeometry.ts index d59861f16..e581de163 100644 --- a/src/cubing/puzzle-geometry/PuzzleGeometry.ts +++ b/src/cubing/puzzle-geometry/PuzzleGeometry.ts @@ -1,5 +1,6 @@ import { Move, QuantumMove } from "../alg"; import type { KPuzzleDefinition, KTransformationData } from "../kpuzzle"; +import { defaultPlatonicColorSchemes } from "./colors"; import { FaceNameSwizzler } from "./FaceNameSwizzler"; import { FaceRenamingMapper, @@ -269,100 +270,6 @@ function defaultnets(): any { }; } -enum PGColors { - White = "#ffffff", - Orange = "#ff8000", - Green = "#44ee00", - Red = "#ff0000", - Blue = "#2266ff", - Yellow = "#f4f400", - - Purple = "#8800dd", - Gray = "#aaaaaa", - Cream = "#e8d0a0", - Pink = "#ff66cc", - - DarkBlue = "#0000ff", - Aqua = "#3399ff", - DarkGreen = "#008800", - Lime = "#99ff00", - DarkGray = "#5c5c5c", - Teal = "#007a89", - Brown = "#7d3b11", - Lavender = "#b9a1ff", - SeaGreen = "#5ec4b6", - VeryDarkGray = "#292929", - Burgundy = "#980000", - Cerise = "#d41f69", -} - -// TODO: change this back to a const JSON definition. -function defaultcolors(): any { - return { - // the colors should use the same naming convention as the nets, above. - 4: { - F: PGColors.Green, - D: PGColors.Yellow, - L: PGColors.Red, - R: PGColors.Blue, - }, - 6: { - U: PGColors.White, - F: PGColors.Green, - R: PGColors.Red, - D: PGColors.Yellow, - B: PGColors.Blue, - L: PGColors.Orange, - }, - 8: { - U: PGColors.White, - F: PGColors.Green, - R: PGColors.Red, - D: PGColors.Yellow, - BB: PGColors.Blue, - L: PGColors.Purple, - BL: PGColors.Orange, - BR: PGColors.Gray, - }, - 12: { - U: PGColors.White, - F: PGColors.DarkGreen, - R: PGColors.Red, - C: PGColors.Cream, - A: PGColors.Aqua, - L: PGColors.Purple, - E: PGColors.Pink, - BF: PGColors.Lime, - BR: PGColors.DarkBlue, - BL: PGColors.Yellow, - I: PGColors.Orange, - D: PGColors.Gray, - }, - 20: { - R: PGColors.Yellow, - C: PGColors.Cerise, - F: PGColors.DarkGreen, - E: PGColors.DarkGray, - L: PGColors.Purple, - U: PGColors.White, - A: PGColors.Teal, - G: PGColors.Red, - I: PGColors.Brown, - S: PGColors.Lavender, - H: PGColors.Aqua, - J: PGColors.SeaGreen, - B: PGColors.Green, - K: PGColors.Cream, - D: PGColors.Gray, - M: PGColors.Pink, - O: PGColors.VeryDarkGray, - P: PGColors.Orange, - N: PGColors.Burgundy, - Q: PGColors.Blue, - }, - }; -} - // Orientation conventions are specified here. For each of the five platonic // solids, by face count, we have three lists of "cubie names" consisting of // a concatenation of face names. For vertex (corner) and edge cubies, the @@ -870,7 +777,7 @@ export class PuzzleGeometry { this.baseFaceCount = baseplanes.length as BaseFaceCount; const net = defaultnets()[baseplanes.length]; this.net = net; - this.colors = defaultcolors()[baseplanes.length]; + this.colors = defaultPlatonicColorSchemes()[baseplanes.length]; if (this.options.verbosity > 0) { console.log(`# Base planes: ${baseplanes.length}`); } diff --git a/src/cubing/puzzle-geometry/colors.ts b/src/cubing/puzzle-geometry/colors.ts new file mode 100644 index 000000000..a22f24008 --- /dev/null +++ b/src/cubing/puzzle-geometry/colors.ts @@ -0,0 +1,93 @@ +export enum PGColors { + White = "#ffffff", + Orange = "#ff8000", + Green = "#44ee00", + Red = "#ff0000", + Blue = "#2266ff", + Yellow = "#f4f400", + + Purple = "#8800dd", + Gray = "#aaaaaa", + Cream = "#e8d0a0", + Pink = "#ff66cc", + + DarkBlue = "#0000ff", + Aqua = "#3399ff", + DarkGreen = "#008800", + Lime = "#99ff00", + DarkGray = "#5c5c5c", + Teal = "#007a89", + Brown = "#7d3b11", + Lavender = "#b9a1ff", + SeaGreen = "#5ec4b6", + VeryDarkGray = "#292929", + Burgundy = "#980000", + Cerise = "#d41f69", +} + +// TODO: change this back to a const JSON definition. +export function defaultPlatonicColorSchemes(): any { + return { + // the colors should use the same naming convention as the nets, above. + 4: { + F: PGColors.Green, + D: PGColors.Yellow, + L: PGColors.Red, + R: PGColors.Blue, + }, + 6: { + U: PGColors.White, + F: PGColors.Green, + R: PGColors.Red, + D: PGColors.Yellow, + B: PGColors.Blue, + L: PGColors.Orange, + }, + 8: { + U: PGColors.White, + F: PGColors.Green, + R: PGColors.Red, + D: PGColors.Yellow, + BB: PGColors.Blue, + L: PGColors.Purple, + BL: PGColors.Orange, + BR: PGColors.Gray, + }, + 12: { + U: PGColors.White, + F: PGColors.DarkGreen, + R: PGColors.Red, + C: PGColors.Cream, + A: PGColors.Aqua, + L: PGColors.Purple, + E: PGColors.Pink, + BF: PGColors.Lime, + BR: PGColors.DarkBlue, + BL: PGColors.Yellow, + I: PGColors.Orange, + D: PGColors.Gray, + }, + 20: { + R: PGColors.Yellow, + C: PGColors.Cerise, + F: PGColors.DarkGreen, + E: PGColors.DarkGray, + L: PGColors.Purple, + U: PGColors.White, + A: PGColors.Teal, + G: PGColors.Red, + I: PGColors.Brown, + S: PGColors.Lavender, + H: PGColors.Aqua, + J: PGColors.SeaGreen, + B: PGColors.Green, + K: PGColors.Cream, + D: PGColors.Gray, + M: PGColors.Pink, + O: PGColors.VeryDarkGray, + P: PGColors.Orange, + N: PGColors.Burgundy, + Q: PGColors.Blue, + }, + }; +}