graphlab-fr / cosma

Cosma is a document graph visualization tool. It modelizes interlinked Markdown files and renders them as an interactive network in a web interface.
https://cosma.arthurperret.fr
GNU General Public License v3.0
125 stars 4 forks source link

[Enhancement] Prettier scrollbar #117

Closed IgnacioHeredia closed 5 months ago

IgnacioHeredia commented 5 months ago

Which part of Cosma is your request about?

Describe your request:

Hi Cosma team,

I just wanted to ask if it would be possible to make the scrollbar prettier. I found this one that looks pretty good: minimal when not selected, expanded when hovered at.

If that's not on the roadmap, any tips on how to modify it with the custom CSS? Because I haven't had luck so far. I'm my case, it looks especially bad because I customized Cosma towards a Dark theme. So the white scrollbar really pops out.

Thanks!

image

infologie commented 5 months ago

@IgnacioHeredia Scrollbars are like buttons, they can look very different depending on which browser and operating system you use. This is something I'd rather not define on our end, I'd rather give users a convenient way to customize these things themselves. Hence the custom CSS feature. For JavaScript-based customization, what we would need to do is add a custom HTML template feature. We've talked about it before but never added it to the roadmap. I'll discuss this with @Myllaume.

In the meantime:

npm install .

instead of

npm install @graphlab-fr/cosma
IgnacioHeredia commented 5 months ago

Hi @infologie ,

I think customizing HTML would be an overkill. Not many people would use it, so I don't think it's worth adding it unless there's a real demand for it.

So I revisited again how to customize it via CSS and I think I found the issue.

I was using this to test the scrollbar customization. I was using only the ::-webkit-scrollbar-thumb element and I wasn't seeing changes. But when I added also the ::-webkit-scrollbar it magically started working!

So I guess the issue is resolved. Thanks @infologie!

IgnacioHeredia commented 5 months ago

For reference, in case someone looks for this in the future, I ended up using this to customize the scrollbar:

/** Customize scrollbar
- nice grey color that fits dark theme
- bigger size when hovering

ref: https://stackoverflow.com/a/70089996
------------------------------------------------------------*/

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  background: #ababab;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover{
  border: 0;
}

::-webkit-scrollbar-track {
  background: transparent;
}