{"version":3,"file":"about.js","sources":["../about.ts"],"sourcesContent":["type ColorMap = Record<string, string>;\n\n/// Colours whose *own* value is legible on this site's dark background.\n///\n/// The element this drives renders the colour's name in that colour, so the\n/// colour is the only thing carrying the word -- there is no other styling to\n/// fall back on. Every entry here clears WCAG AA (4.5:1) against --color-bg.\n///\n/// Colours that cannot be shown in their own colour on a near-black background\n/// are left out rather than lightened. Blue, brown, indigo, maroon, purple and\n/// the rest need roughly 50%+ lightness to clear the bar, and at that point they\n/// stop looking like themselves: brown becomes #e18787 and blue becomes #9494ff,\n/// so the page would claim a word is written in a colour it plainly is not.\n///\n/// That is a deliberate trade of variety for truth. The joke only works if the\n/// word really is in the colour it names.\n///\n/// Print is the other half and cannot be solved here: the colour is set inline by\n/// this script, so no media query can adapt it to the white page the print\n/// stylesheet produces, where every colour in this list would be 1.02:1 to 1.4:1.\n/// arrys.css forces these spans to ink in @media print instead. A colour\n/// readable on both a near-black and a near-white background would need a\n/// luminance between 0.183 and 0.198, which is an empty interval -- there is no\n/// such colour, so print has to give the colour up.\nconst COLORS: ColorMap = {\n  aqua: \"#00ffff\",\n  beige: \"#f5f5dc\",\n  cyan: \"#00ffff\",\n  \"dark khaki\": \"#bdb76b\",\n  \"dark salmon\": \"#e9967a\",\n  fuchsia: \"#ff00ff\",\n  gold: \"#ffd700\",\n  khaki: \"#f0e68c\",\n  \"light blue\": \"#add8e6\",\n  \"light green\": \"#90ee90\",\n  \"light yellow\": \"#ffffe0\",\n  lime: \"#00ff00\",\n  magenta: \"#ff00ff\",\n  olive: \"#808000\",\n  pink: \"#ffc0cb\",\n  // CSS violet is #ee82ee. This said #800080, which is purple, so the word\n  // \"violet\" was being shown in purple.\n  violet: \"#ee82ee\",\n  red: \"#ff0000\",\n  yellow: \"#ffff00\",\n};\n\nconst getRandomColorPair = (): { name: string; rgb: string } => {\n  const names = Object.keys(COLORS);\n  const name = names[Math.floor(Math.random() * names.length)];\n  return { name, rgb: COLORS[name] };\n};\n\nwindow.addEventListener(\"DOMContentLoaded\", () => {\n  const placeholder = document.querySelector<HTMLElement>(\".random-color\");\n  if (placeholder) {\n    const colorPair = getRandomColorPair();\n    placeholder.style.color = colorPair.rgb;\n    placeholder.textContent = colorPair.name;\n  }\n});\n"],"names":["COLORS","getRandomColorPair","names","name","placeholder","colorPair"],"mappings":"AAwBA,MAAMA,EAAmB,CACvB,KAAM,UACN,MAAO,UACP,KAAM,UACN,aAAc,UACd,cAAe,UACf,QAAS,UACT,KAAM,UACN,MAAO,UACP,aAAc,UACd,cAAe,UACf,eAAgB,UAChB,KAAM,UACN,QAAS,UACT,MAAO,UACP,KAAM,UAGN,OAAQ,UACR,IAAK,UACL,OAAQ,SACV,EAEMC,EAAqB,IAAqC,CAC9D,MAAMC,EAAQ,OAAO,KAAKF,CAAM,EAC1BG,EAAOD,EAAM,KAAK,MAAM,KAAK,OAAA,EAAWA,EAAM,MAAM,CAAC,EAC3D,MAAO,CAAE,KAAAC,EAAM,IAAKH,EAAOG,CAAI,CAAA,CACjC,EAEA,OAAO,iBAAiB,mBAAoB,IAAM,CAChD,MAAMC,EAAc,SAAS,cAA2B,eAAe,EACvE,GAAIA,EAAa,CACf,MAAMC,EAAYJ,EAAA,EAClBG,EAAY,MAAM,MAAQC,EAAU,IACpCD,EAAY,YAAcC,EAAU,IACtC,CACF,CAAC"}