cheogram-www

created pr with cheogram-www/links-links-links.1 on 2026-11-25T22:10:55Z · by 3c31bc8c
commented on 2026-11-25T22:10:56Z · by 3c31bc8c
Changes are available at https://tangled.org/mrry.band/cheogram-www links-links-links
added cheogram-www/links-links-links.2 on 2026-11-25T22:26:51Z · by 3c31bc8c
1: ec332d4 < -: ------- Link styling
-: ------- > 1: 04637e6 Link styling
added cheogram-www/links-links-links.3 on 2026-11-25T23:40:35Z · by 3c31bc8c
1: 04637e6 ! 1: d1d8a3d Link styling
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:links-links-links | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:links-links-links [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:links-links-links
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:links-links-links "lgtm!"

Patchset cheogram-www/links-links-links.2 on 2026-11-25T22:26:51Z · commit 04637e6

Link styling
Eric Roberts 2026-11-25T22:10:35Z
Diff stat
src/App.scss | 63 +++++++++++++++++++++++-------
src/theme.ts | 46 ++++++++++++++++++----
2 files changed, 86 insertions(+), 23 deletions(-)
Semantic diff summary
1 added, 1 modified, 0 signature changed, 0 removed across 1 analyzed file (1 file skipped: unsupported file type)
+48 -15 src/App.scss #
......@@ -52,6 +52,7 @@ $main-container-sidebar-right-max-width: 22em;
5252 color-mix(in srgb, var(--theme-primary) 8%, var(--surface-base))
5353 );
5454 --color-primary-dark: var(--theme-light-link, #7401cf);
55+ --theme-chat-link: var(--theme-light-chat-link, #7401cf);
5556 --theme-secondary-surface: var(--theme-light-secondary-surface);
5657 --color-secondary: var(
5758 --theme-secondary-surface,
......@@ -103,6 +104,10 @@ $main-container-sidebar-right-max-width: 22em;
103104 color-mix(in srgb, var(--text-base) 7%, var(--surface-base))
104105 );
105106 --theme-incoming-background: var(--theme-light-incoming-background);
107+ --message-outgoing-link: var(
108+ --theme-light-outgoing-link,
109+ var(--theme-on-primary)
110+ );
106111 --message-outgoing-background: var(
107112 --theme-light-outgoing-background,
108113 var(--theme-primary)
......@@ -123,6 +128,10 @@ $main-container-sidebar-right-max-width: 22em;
123128 --accent-surface: var(--theme-dark-accent-surface);
124129 color-scheme: dark;
125130 --theme-incoming-background: var(--theme-dark-incoming-background);
131+ --message-outgoing-link: var(
132+ --theme-dark-outgoing-link,
133+ var(--color-secondary-dark)
134+ );
126135 --message-outgoing-background: var(
127136 --theme-dark-outgoing-background,
128137 var(--theme-primary)
......@@ -149,6 +158,12 @@ $main-container-sidebar-right-max-width: 22em;
149158 color-mix(in srgb, var(--theme-primary) 24%, var(--surface-base))
150159 );
151160 --color-primary-dark: var(--theme-dark-link, #c99aff);
161+ --theme-chat-link: var(--theme-dark-chat-link, var(--color-secondary-dark));
162+ --chat-link-underline: color-mix(
163+ in srgb,
164+ var(--color-secondary-dark) 85%,
165+ transparent
166+ );
152167 --chat-panel-border: color-mix(in srgb, var(--text-base) 12%, transparent);
153168 --chat-panel-background: color-mix(
154169 in srgb,
......@@ -1188,6 +1203,7 @@ div.cs-message__content {
11881203 white-space: nowrap;
11891204 overflow: hidden;
11901205 text-overflow: ellipsis;
1206+ padding-bottom: 2px;
11911207 font-size: 0.81rem;
11921208 user-select: text;
11931209 }
......@@ -1749,6 +1765,37 @@ img.thread {
17491765 }
17501766 }
17511767
1768+.cs-conversation-header__content .pinned a,
1769+#welcome-box a,
1770+.chat-composer .ql-editor a,
1771+section.cs-message .cs-message__custom-content a {
1772+ color: var(--chat-link-color, var(--theme-chat-link));
1773+ text-decoration: underline;
1774+ text-decoration-thickness: 2px;
1775+ text-decoration-skip-ink: auto;
1776+ text-decoration-color: var(
1777+ --chat-link-underline,
1778+ var(--color-secondary-dark)
1779+ );
1780+ background-image: linear-gradient(
1781+ var(--color-secondary-dark),
1782+ var(--color-secondary-dark)
1783+ );
1784+ background-repeat: no-repeat;
1785+ background-position: bottom;
1786+ background-size: 100% 0;
1787+ -webkit-box-decoration-break: clone;
1788+ box-decoration-break: clone;
1789+ transition: background-size 250ms ease;
1790+
1791+ &:hover,
1792+ &:focus-visible {
1793+ color: var(--color-on-secondary);
1794+ text-decoration-color: transparent;
1795+ background-size: 100% 100%;
1796+ }
1797+}
1798+
17521799 section.cs-message {
17531800 overflow: visible;
17541801 position: relative;
......@@ -1787,22 +1834,8 @@ section.cs-message {
17871834 cursor: pointer;
17881835 }
17891836
1790- .cs-message__custom-content a {
1791- color: var(--color-primary-dark);
1792- text-decoration: underline;
1793- text-underline-offset: 0.15em;
1794- text-decoration-thickness: 1px;
1795- text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
1796- transition: text-decoration-color 250ms ease;
1797-
1798- &:hover,
1799- &:focus-visible {
1800- text-decoration-color: currentColor;
1801- }
1802- }
1803-
18041837 &.cs-message--outgoing .cs-message__custom-content a {
1805- color: var(--message-outgoing-color);
1838+ --chat-link-color: var(--message-outgoing-link);
18061839 }
18071840
18081841 .cs-message__header {
+38 -8 src/theme.ts #
......@@ -185,6 +185,23 @@ function foreground(background: string) {
185185 : "#000000";
186186 }
187187
188+function linkColor(
189+ accent: string,
190+ backgrounds: string[],
191+ target: string,
192+ minimumContrast = 4.5,
193+) {
194+ let link = accent;
195+ for (
196+ let step = 1;
197+ backgrounds.some((bg) => contrast(link, bg) < minimumContrast) &&
198+ step <= 100;
199+ step++
200+ )
201+ link = mix(accent, target, 1 - step / 100);
202+ return link;
203+}
204+
188205 export function themeVariables(theme: {
189206 light: PresetPalette;
190207 dark: PresetPalette;
......@@ -206,6 +223,11 @@ export function themeVariables(theme: {
206223 : (theme[mode].outgoingBackground ?? primary);
207224 const outgoingColor =
208225 theme[mode].outgoingColor ?? foreground(outgoingBackground);
226+ const outgoingLinkTint = mix(secondary, outgoingColor, 0.15);
227+ const outgoingLink =
228+ [secondary, outgoingLinkTint, outgoingColor].find(
229+ (color) => contrast(color, outgoingBackground) >= 4.5,
230+ ) ?? foreground(outgoingBackground);
209231 const backgrounds = [
210232 background,
211233 incomingBackground ?? mix(text, background, 0.07),
......@@ -214,13 +236,10 @@ export function themeVariables(theme: {
214236 secondarySurface,
215237 ];
216238 const target = foreground(background);
217- let link = primary;
218- for (
219- let step = 1;
220- backgrounds.some((bg) => contrast(link, bg) < 4.5) && step <= 100;
221- step++
222- )
223- link = mix(primary, target, 1 - step / 100);
239+ const chatLink =
240+ mode === "light"
241+ ? linkColor(primary, backgrounds, target, 6)
242+ : linkColor(secondary, backgrounds, target);
224243 const colours = {
225244 background,
226245 text,
......@@ -231,10 +250,21 @@ export function themeVariables(theme: {
231250 "incoming-background": incomingBackground ?? "initial",
232251 "outgoing-background": outgoingBackground,
233252 "outgoing-color": outgoingColor,
253+ "outgoing-link":
254+ mode === "dark"
255+ ? outgoingLink
256+ : contrast(chatLink, outgoingBackground) >= 4.5
257+ ? chatLink
258+ : linkColor(
259+ primary,
260+ [outgoingBackground],
261+ foreground(outgoingBackground),
262+ ),
234263 "on-primary": foreground(primary),
235264 "on-secondary": foreground(secondary),
236265 "on-app": foreground(primary),
237- link,
266+ link: linkColor(primary, backgrounds, target),
267+ "chat-link": chatLink,
238268 };
239269 for (const [role, colour] of Object.entries(colours))
240270 variables[`--theme-${mode}-${role}`] = colour;
Back to top