Skip to content
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

Section permalinks: fix hover styling #813

Closed
wants to merge 2 commits into from

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Jul 7, 2024

  • Remove text-decoration from the permalink icons, because it's barely visible and looks odd.
  • To ensure they still have some hover-responsiveness, define a new brand color (--color-brand-highlight) — which in the default themes is simply --color-brand-content with the L value dialed up a bunch in the HSL colorspace — and set it as the permalink hover color.
  • Also override visited-link coloring from permalinks, as a special case, and have them always use the brand-content / brand-highlight color.

Additional info

This was inspired by the fact that every time I hover over a section title, the section link icon appears, accompanied by a tiny dot in the lower-left corner that gets marginally more visible when the icon is hovered over. It took me forever to figure out that it even was the tiny bit of the text-decoration-line that's actually visible around the icon's descender. But once I did work that out, it seemed really pointless for it to be there, doing nothing useful.

Adding an additional brand color is a big flex just for this tiny feature, I realize. Alternatives would be to have the permalink icon hover to the text color, or to reverse that and have it initially appear text-colored, but hover to link color. I didn't try either of those, but they're options if adding the "special" highlight color seems too drastic.

Regarding the visited-link override: I normally hate when sites disable visited-link coloring, and will typically userstyle it back in with extreme prejudice. But I didn't want to have to define a second highlight color for the permalink hovers when they're also visited links, and permalinks are enough of a special case that I think not having them turn purple when used seems valid.

ferdnyc added 2 commits July 7, 2024 05:07
- Remove `text-decoration` from the permalink icons, because it's barely
  visible and looks odd.
- To ensure they still have some hover-responsiveness, define a new
  brand color (`--color-brand-highlight`) — which in the default themes
  is simply `--color-brand` with the `L` value dialed up a bunch in the
  HSL colorspace — and set it as the permalink hover color.
- Also override visited-link coloring from permalinks, as a special case,
  and have them always use the brand / brand-highlight color.
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 7, 2024

Oh, this PR branch also includes my fix from #812, since I needed it to get the linter to pass. But presumably that'll be merged before this. Already merged.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 7, 2024

They really shouldn't be referred to as permalinks, because they're not, they're merely section links. But they were called that way in the code, so now I've started doing it too.

Worse, I named the new variables --color-permalink-*, which in retrospect was a poor choice. I can change that in this PR, or even scrub the term 'permalink' from the code entirely, if anyone feels strongly enough about it.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 7, 2024

Screencasts demonstrating the change, in both themes, converted to animated GIF courtesy of ezgif.com:

Before

FuroLinks-Before

After

FuroLinks-After

@pradyunsg
Copy link
Owner

pradyunsg commented Jul 7, 2024

Remove text-decoration from the permalink icons, because it's barely visible and looks odd.

This is platform-specific and depends on the fonts available on the system being used. My guess is that you're on a Linux host where it's falling back to a font with a really tall symbol for that character.

Screen.Recording.2024-07-07.at.11.49.29.mov

I don't think permalinks should be special-cased as done in this PR though, since they're still links so don't really need custom colours.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 9, 2024

You're definitely right about it being platform-specific... here's how things look in Google Chrome on Android, I just discovered:

Screenshot_20240708_235645_Chrome.png

On the bright side, you do see more of the underline decoration...

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jul 24, 2024

Well, the Android thing is still somewhat concerning, and I do think the hover response of section links could be improved, but this doesn't seem to be the way to do it. Closing.

@ferdnyc ferdnyc closed this Jul 24, 2024
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.

2 participants