Skip to content

Fix: Improve footnote and citation colors in Distill posts #3172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 23, 2025

Conversation

alshedivat
Copy link
Owner

@alshedivat alshedivat commented May 22, 2025

Fixes #3168. (Implemented by jules.google.)

This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

  1. d-hover-box Internal Styling (template.v2.js):
    The <style> tag within the d-hover-box component's template
    in assets/js/distillpub/template.v2.js has been updated.
    Styles for .panel (the main pop-up container) now define:

    • background-color: var(--global-card-bg-color);
    • border: 1px solid var(--global-divider-color);
    • color: var(--global-text-color); (for default text)
    • Links within the panel are styled with
      color: var(--global-theme-color); and
      color: var(--global-hover-color); on hover.
      This ensures pop-up content is correctly themed from within its
      shadow DOM.
  2. Footnote/Citation Number Color (template.v2.js):
    The hardcoded hsla(206, 90%, 20%, 0.7) color previously used for
    footnote numbers (in d-footnote template) and citation numbers
    (in d-cite template) in assets/js/distillpub/template.v2.js
    has been replaced with color: var(--global-theme-color);.

  3. Cleaned _sass/_distill.scss:
    Removed the (now redundant) global CSS overrides for d-hover-box
    from _sass/_distill.scss, as these styles are now correctly
    encapsulated within the d-hover-box component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.

This commit addresses an issue where footnotes, citations, and their
pop-ups had poor contrast in dark mode on Distill-style blog posts.

The following changes were made to `_sass/_distill.scss`:

- Footnotes (`d-footnote`) and citations (`d-cite a`, `a.citation`) now use the CSS variable `var(--global-theme-color)` for their text color. This variable is theme-aware and ensures appropriate visibility in both light and dark modes.
- Hover states for footnotes and citations now use `var(--global-hover-color)`.
- Footnote pop-ups (using the `d-hover-box` custom element) have been styled:
    - Background color is set to `var(--global-card-bg-color)`.
    - Border is set to `1px solid var(--global-divider-color)`.
    - Text color within the pop-up is `var(--global-text-color)`.
    - Links within the pop-up also use `var(--global-theme-color)`.

These changes ensure that footnotes, citations, and their associated pop-ups are readable and have good contrast in both light and dark themes, consistent with the overall site styling.
Copy link

netlify bot commented May 22, 2025

Deploy Preview for relaxed-lollipop-b6bc17 ready!

Name Link
🔨 Latest commit 3fee4e8
🔍 Latest deploy log https://app.netlify.com/projects/relaxed-lollipop-b6bc17/deploys/68307602f6826d0008482445
😎 Deploy Preview https://deploy-preview-3172--relaxed-lollipop-b6bc17.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

github-actions bot commented May 22, 2025

Failed prettier code check. Check this file for more information.

This commit addresses issues with hardcoded colors in Distill-style
posts, ensuring that footnote/citation numbers and their pop-ups
respect the site's light/dark theme settings.

Specifically, this commit includes:

1.  **Footnote/Citation Number Color:**
    Modified `assets/js/distillpub/template.v2.js` to change the
    inline styles for `d-cite` and `d-footnote` custom elements.
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color for the
    numbers (spans/sup elements) has been replaced with
    `var(--global-theme-color)`.

2.  **Citation/Footnote Pop-up Styling (`d-hover-box`):**
    Ensured that styles in `_sass/_distill.scss` for `d-hover-box`
    (used by both footnotes and citations for their pop-ups) correctly
    use theme variables:
    - `background-color: var(--global-card-bg-color)`
    - `border: 1px solid var(--global-divider-color)`
    - `color: var(--global-text-color)` for text content
    - `a { color: var(--global-theme-color); }` for links

These changes ensure that all aspects of footnotes and citations,
including their pop-up previews, are now consistently styled
according to the active theme, improving readability and visual
consistency, especially in dark mode.
This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

1.  **`d-hover-box` Internal Styling (template.v2.js):**
    The `<style>` tag within the `d-hover-box` component's template
    in `assets/js/distillpub/template.v2.js` has been updated.
    Styles for `.panel` (the main pop-up container) now define:
    - `background-color: var(--global-card-bg-color);`
    - `border: 1px solid var(--global-divider-color);`
    - `color: var(--global-text-color);` (for default text)
    - Links within the panel are styled with
      `color: var(--global-theme-color);` and
      `color: var(--global-hover-color);` on hover.
    This ensures pop-up content is correctly themed from within its
    shadow DOM.

2.  **Footnote/Citation Number Color (template.v2.js):**
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for
    footnote numbers (in `d-footnote` template) and citation numbers
    (in `d-cite` template) in `assets/js/distillpub/template.v2.js`
    has been replaced with `color: var(--global-theme-color);`.

3.  **Cleaned `_sass/_distill.scss`:**
    Removed the (now redundant) global CSS overrides for `d-hover-box`
    from `_sass/_distill.scss`, as these styles are now correctly
    encapsulated within the `d-hover-box` component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.
@alshedivat alshedivat merged commit 71969cc into main May 23, 2025
10 checks passed
OmidSa75 pushed a commit to OmidSa75/OmidSa75.github.io that referenced this pull request Jun 8, 2025
…t#3172)

Fixes alshedivat#3168. (Implemented by [jules.google](https://jules.google).)

This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

1.  **`d-hover-box` Internal Styling (template.v2.js):**
    The `<style>` tag within the `d-hover-box` component's template
    in `assets/js/distillpub/template.v2.js` has been updated.
    Styles for `.panel` (the main pop-up container) now define:
    - `background-color: var(--global-card-bg-color);`
    - `border: 1px solid var(--global-divider-color);`
    - `color: var(--global-text-color);` (for default text)
    - Links within the panel are styled with
      `color: var(--global-theme-color);` and
      `color: var(--global-hover-color);` on hover.
    This ensures pop-up content is correctly themed from within its
    shadow DOM.

2.  **Footnote/Citation Number Color (template.v2.js):**
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for
    footnote numbers (in `d-footnote` template) and citation numbers
    (in `d-cite` template) in `assets/js/distillpub/template.v2.js`
    has been replaced with `color: var(--global-theme-color);`.

3.  **Cleaned `_sass/_distill.scss`:**
    Removed the (now redundant) global CSS overrides for `d-hover-box`
    from `_sass/_distill.scss`, as these styles are now correctly
    encapsulated within the `d-hover-box` component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
odcambc pushed a commit to odcambc/odcambc.github.io that referenced this pull request Jul 13, 2025
…t#3172)

Fixes alshedivat#3168. (Implemented by [jules.google](https://jules.google).)

This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

1.  **`d-hover-box` Internal Styling (template.v2.js):**
    The `<style>` tag within the `d-hover-box` component's template
    in `assets/js/distillpub/template.v2.js` has been updated.
    Styles for `.panel` (the main pop-up container) now define:
    - `background-color: var(--global-card-bg-color);`
    - `border: 1px solid var(--global-divider-color);`
    - `color: var(--global-text-color);` (for default text)
    - Links within the panel are styled with
      `color: var(--global-theme-color);` and
      `color: var(--global-hover-color);` on hover.
    This ensures pop-up content is correctly themed from within its
    shadow DOM.

2.  **Footnote/Citation Number Color (template.v2.js):**
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for
    footnote numbers (in `d-footnote` template) and citation numbers
    (in `d-cite` template) in `assets/js/distillpub/template.v2.js`
    has been replaced with `color: var(--global-theme-color);`.

3.  **Cleaned `_sass/_distill.scss`:**
    Removed the (now redundant) global CSS overrides for `d-hover-box`
    from `_sass/_distill.scss`, as these styles are now correctly
    encapsulated within the `d-hover-box` component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
easrai pushed a commit to easrai/easrai.github.io that referenced this pull request Jul 14, 2025
…t#3172)

Fixes alshedivat#3168. (Implemented by [jules.google](https://jules.google).)

This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

1.  **`d-hover-box` Internal Styling (template.v2.js):**
    The `<style>` tag within the `d-hover-box` component's template
    in `assets/js/distillpub/template.v2.js` has been updated.
    Styles for `.panel` (the main pop-up container) now define:
    - `background-color: var(--global-card-bg-color);`
    - `border: 1px solid var(--global-divider-color);`
    - `color: var(--global-text-color);` (for default text)
    - Links within the panel are styled with
      `color: var(--global-theme-color);` and
      `color: var(--global-hover-color);` on hover.
    This ensures pop-up content is correctly themed from within its
    shadow DOM.

2.  **Footnote/Citation Number Color (template.v2.js):**
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for
    footnote numbers (in `d-footnote` template) and citation numbers
    (in `d-cite` template) in `assets/js/distillpub/template.v2.js`
    has been replaced with `color: var(--global-theme-color);`.

3.  **Cleaned `_sass/_distill.scss`:**
    Removed the (now redundant) global CSS overrides for `d-hover-box`
    from `_sass/_distill.scss`, as these styles are now correctly
    encapsulated within the `d-hover-box` component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Teusner pushed a commit to Teusner/Teusner.github.io that referenced this pull request Jul 30, 2025
…t#3172)

Fixes alshedivat#3168. (Implemented by [jules.google](https://jules.google).)

This commit resolves issues with footnote and citation styling in
Distill posts, particularly ensuring that pop-up contents and the
numbers themselves respect the site's light/dark theme via shadow DOM
style definitions.

Key changes:

1.  **`d-hover-box` Internal Styling (template.v2.js):**
    The `<style>` tag within the `d-hover-box` component's template
    in `assets/js/distillpub/template.v2.js` has been updated.
    Styles for `.panel` (the main pop-up container) now define:
    - `background-color: var(--global-card-bg-color);`
    - `border: 1px solid var(--global-divider-color);`
    - `color: var(--global-text-color);` (for default text)
    - Links within the panel are styled with
      `color: var(--global-theme-color);` and
      `color: var(--global-hover-color);` on hover.
    This ensures pop-up content is correctly themed from within its
    shadow DOM.

2.  **Footnote/Citation Number Color (template.v2.js):**
    The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for
    footnote numbers (in `d-footnote` template) and citation numbers
    (in `d-cite` template) in `assets/js/distillpub/template.v2.js`
    has been replaced with `color: var(--global-theme-color);`.

3.  **Cleaned `_sass/_distill.scss`:**
    Removed the (now redundant) global CSS overrides for `d-hover-box`
    from `_sass/_distill.scss`, as these styles are now correctly
    encapsulated within the `d-hover-box` component itself.

These changes ensure that all aspects of Distill footnotes and
citations (numbers, pop-up background, pop-up text, and links within
pop-ups) are styled using theme-aware CSS variables, providing
correct visual appearance and readability in both light and dark modes.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Footnote and Citation color on Distill style posts
2 participants