cheogram-www
created pr with
cheogram-www/links-links-links.1
commented
Changes are available at https://tangled.org/mrry.band/cheogram-www links-links-links
added cheogram-www/links-links-links.2
1: ec332d4 < -: ------- Link styling
-: ------- > 1: 04637e6 Link styling
added cheogram-www/links-links-links.3
1: 04637e6 ! 1: d1d8a3d Link styling
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:links-links-links | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:links-links-links [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:links-links-linksadd comment to patch request:
ssh pr.pico.sh comment cheogram-www:links-links-links "lgtm!"
Patchset
cheogram-www/links-links-links.3
Link styling
Eric Roberts
2026-11-25T22:10:35ZSemantic 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; | |
| 52 | 52 | color-mix(in srgb, var(--theme-primary) 8%, var(--surface-base)) | |
| 53 | 53 | ); | |
| 54 | 54 | --color-primary-dark: var(--theme-light-link, #7401cf); | |
| 55 | + | --theme-chat-link: var(--theme-light-chat-link, #7401cf); | |
| 55 | 56 | --theme-secondary-surface: var(--theme-light-secondary-surface); | |
| 56 | 57 | --color-secondary: var( | |
| 57 | 58 | --theme-secondary-surface, |
| ... | ... | @@ -103,6 +104,10 @@ $main-container-sidebar-right-max-width: 22em; | |
| 103 | 104 | color-mix(in srgb, var(--text-base) 7%, var(--surface-base)) | |
| 104 | 105 | ); | |
| 105 | 106 | --theme-incoming-background: var(--theme-light-incoming-background); | |
| 107 | + | --message-outgoing-link: var( | |
| 108 | + | --theme-light-outgoing-link, | |
| 109 | + | var(--theme-on-primary) | |
| 110 | + | ); | |
| 106 | 111 | --message-outgoing-background: var( | |
| 107 | 112 | --theme-light-outgoing-background, | |
| 108 | 113 | var(--theme-primary) |
| ... | ... | @@ -123,6 +128,10 @@ $main-container-sidebar-right-max-width: 22em; | |
| 123 | 128 | --accent-surface: var(--theme-dark-accent-surface); | |
| 124 | 129 | color-scheme: dark; | |
| 125 | 130 | --theme-incoming-background: var(--theme-dark-incoming-background); | |
| 131 | + | --message-outgoing-link: var( | |
| 132 | + | --theme-dark-outgoing-link, | |
| 133 | + | var(--color-secondary-dark) | |
| 134 | + | ); | |
| 126 | 135 | --message-outgoing-background: var( | |
| 127 | 136 | --theme-dark-outgoing-background, | |
| 128 | 137 | var(--theme-primary) |
| ... | ... | @@ -149,6 +158,12 @@ $main-container-sidebar-right-max-width: 22em; | |
| 149 | 158 | color-mix(in srgb, var(--theme-primary) 24%, var(--surface-base)) | |
| 150 | 159 | ); | |
| 151 | 160 | --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 | + | ); | |
| 152 | 167 | --chat-panel-border: color-mix(in srgb, var(--text-base) 12%, transparent); | |
| 153 | 168 | --chat-panel-background: color-mix( | |
| 154 | 169 | in srgb, |
| ... | ... | @@ -1749,6 +1765,37 @@ img.thread { | |
| 1749 | 1765 | } | |
| 1750 | 1766 | } | |
| 1751 | 1767 | ||
| 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: 1px; | |
| 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 | + | ||
| 1752 | 1799 | section.cs-message { | |
| 1753 | 1800 | overflow: visible; | |
| 1754 | 1801 | position: relative; |
| ... | ... | @@ -1787,22 +1834,8 @@ section.cs-message { | |
| 1787 | 1834 | cursor: pointer; | |
| 1788 | 1835 | } | |
| 1789 | 1836 | ||
| 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 | - | ||
| 1804 | 1837 | &.cs-message--outgoing .cs-message__custom-content a { | |
| 1805 | - | color: var(--message-outgoing-color); | |
| 1838 | + | --chat-link-color: var(--message-outgoing-link); | |
| 1806 | 1839 | } | |
| 1807 | 1840 | ||
| 1808 | 1841 | .cs-message__header { |
+38
-8
src/theme.ts
#
| ... | ... | @@ -185,6 +185,23 @@ function foreground(background: string) { | |
| 185 | 185 | : "#000000"; | |
| 186 | 186 | } | |
| 187 | 187 | ||
| 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 | + | ||
| 188 | 205 | export function themeVariables(theme: { | |
| 189 | 206 | light: PresetPalette; | |
| 190 | 207 | dark: PresetPalette; |
| ... | ... | @@ -206,6 +223,11 @@ export function themeVariables(theme: { | |
| 206 | 223 | : (theme[mode].outgoingBackground ?? primary); | |
| 207 | 224 | const outgoingColor = | |
| 208 | 225 | 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); | |
| 209 | 231 | const backgrounds = [ | |
| 210 | 232 | background, | |
| 211 | 233 | incomingBackground ?? mix(text, background, 0.07), |
| ... | ... | @@ -214,13 +236,10 @@ export function themeVariables(theme: { | |
| 214 | 236 | secondarySurface, | |
| 215 | 237 | ]; | |
| 216 | 238 | 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); | |
| 224 | 243 | const colours = { | |
| 225 | 244 | background, | |
| 226 | 245 | text, |
| ... | ... | @@ -231,10 +250,21 @@ export function themeVariables(theme: { | |
| 231 | 250 | "incoming-background": incomingBackground ?? "initial", | |
| 232 | 251 | "outgoing-background": outgoingBackground, | |
| 233 | 252 | "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 | + | ), | |
| 234 | 263 | "on-primary": foreground(primary), | |
| 235 | 264 | "on-secondary": foreground(secondary), | |
| 236 | 265 | "on-app": foreground(primary), | |
| 237 | - | link, | |
| 266 | + | link: linkColor(primary, backgrounds, target), | |
| 267 | + | "chat-link": chatLink, | |
| 238 | 268 | }; | |
| 239 | 269 | for (const [role, colour] of Object.entries(colours)) | |
| 240 | 270 | variables[`--theme-${mode}-${role}`] = colour; |