From 000e644c6b6ddebad6c169c5e055952716783589 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 8 Oct 2025 22:10:42 -0400 Subject: [PATCH] feat: color --- public/scripts/index.js | 24 ++++++++++++------- .../algorithms/extrema-circular-buffer.mdx | 4 ++++ src/layouts/BaseLayout.astro | 6 +++-- src/utils/colors.js | 6 +++-- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/public/scripts/index.js b/public/scripts/index.js index e7a847c..88b5194 100644 --- a/public/scripts/index.js +++ b/public/scripts/index.js @@ -204,19 +204,22 @@ document.body.addEventListener("click", (e) => { if (e.target.closest(".home-link")) return handleHomeClick(e); - if (e.target.closest("[data-topic]")) return handleDataTopicClick(e); + if (e.target.closest(".topics [data-topic]")) + return handleDataTopicClick(e); }); document.body.addEventListener( "mouseenter", (e) => { - const link = e.target.closest("[data-topic]"); + const link = e.target.closest(".topics [data-topic]"); if (!link) return; - const color = - (window.getTopicColor && - window.getTopicColor(link.dataset.topic?.toLowerCase() || "")) || - ""; - if (color) link.style.color = color; + const raw = link.dataset.topic || ""; + const key = raw.split("/")[0].toLowerCase(); + const color = (window.getTopicColor && window.getTopicColor(key)) || ""; + if (color) { + link.style.color = color; + link.style.textDecorationColor = color; + } }, true, ); @@ -224,9 +227,12 @@ document.body.addEventListener( "mouseleave", (e) => { - const link = e.target.closest("[data-topic]"); + const link = e.target.closest(".topics [data-topic]"); if (!link) return; - if (!link.classList.contains("active")) link.style.color = ""; + if (!link.classList.contains("active")) { + link.style.color = ""; + link.style.textDecorationColor = ""; + } }, true, ); diff --git a/src/content/algorithms/extrema-circular-buffer.mdx b/src/content/algorithms/extrema-circular-buffer.mdx index ed6543f..8250f0e 100644 --- a/src/content/algorithms/extrema-circular-buffer.mdx +++ b/src/content/algorithms/extrema-circular-buffer.mdx @@ -4,6 +4,9 @@ date: "30/07/2024" useKatex: true --- +import { Code } from 'astro:components'; + + # context While working for [TRB Capital Management](https://trbcap.com/), certain strategies necessitated finding the minimum and maximum of a moving window of prices. @@ -12,6 +15,7 @@ While working for [TRB Capital Management](https://trbcap.com/), certain strateg Design a data structure supporting the following operations: + - `build(size_t capacity)` : initialize the data structure with capacity/window size `capacity` The data structure must always hold $\leq$ `capacity` prices. - `void push_back(double value)` diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index dc7aadc..333f3e1 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -29,7 +29,7 @@ const {