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

[CssBaseline] Add dark mode scrollbar support #23407

Merged
merged 5 commits into from
Nov 8, 2020

Conversation

mmmols
Copy link
Contributor

@mmmols mmmols commented Nov 5, 2020

@mmmols

This comment has been minimized.

@mui-pr-bot
Copy link

mui-pr-bot commented Nov 5, 2020

@material-ui/core: parsed: +0.17% , gzip: +0.16%

Details of bundle changes

Generated by 🚫 dangerJS against b42a395

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 5, 2020

I have recently found that Azure uses a similar approach. They have managed to get the hover feedback working (which is better than to have it on active). Do you think that you could have a look at it? See how they pulled it off and apply it here too? It looks better than what I did :)

@oliviertassinari oliviertassinari changed the title style: adds dark mode scrollbar in respect to macOS dark mode [CssBaseline] Add dark mode scrollbar support Nov 5, 2020
@oliviertassinari oliviertassinari added component: CssBaseline The React component new feature New feature or request labels Nov 5, 2020
Comment on lines 27 to 32
const scrollBar = {
track: '#2b2b2b',
thumb: '#6b6b6b',
active: '#959595',
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to the theme instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's needed. It's meant to match the need of a dark theme, not custom colors a theme might have.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliviertassinari how dark is the dark theme? That is where I am getting to since it may be the case that different colors would be nicer for the scrollbar.

That being said, I am not sure, since I use transparent colors in my apps

Example:

{
 '*:-webkit-full-screen': {
        height: '100%',
        width: '100%',
      },
      '::-webkit-scrollbar': {
        width: '6px',
      },
      '::-webkit-scrollbar-button': {
        height: 0,
        width: 0,
      },
      '::-webkit-scrollbar-thumb': {
        background: 'hsla(0, 0%, 0%, 0.2)',
        borderRadius: '3em',
        transition: 'all .3s ease-in-out',
      },
      '::-webkit-scrollbar-track': {
        background: 'hsla(0, 0%, 0%, 0)',
      },
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any code style for this? I also like having one color and then tinkering with the opacity value.

Copy link
Member

@oliviertassinari oliviertassinari Nov 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how dark is the dark theme?

Exactly, this was my point. On a light theme, end-users are used to using the same color for the scrollbar no matter how light the theme is, it very often white or slightly grey. I'm hoping we could still benefit from this simplification.

Regarding going in a direction of allowing to customize these values. What would be the API?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliviertassinari got it,

But that is exactly what I don't like either 😄 if you notice I change the scrollbar regardless since I am taking control over it.

I don't see any harm moving into the theme in cases people want to mess with it like I am doing.

Unless there is a technical reason why not to do it 🤷🏻

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any harm moving into the theme in cases people want to mess with it like I am doing.

Any proposal for the API?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static object seems to be a good API as far as I can tell.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, do you have an example from a developer's perspective?

@mmmols
Copy link
Contributor Author

mmmols commented Nov 6, 2020

got the hover working and looked at what they did at azure. It seems they're having classes for their "custom" scrollbar, but I just applied what we already have and added :hover. Works on my end. Let me know, if this was not what you were asking for?

oliviertassinari added a commit to oliviertassinari/mui-x that referenced this pull request Nov 7, 2020
@oliviertassinari oliviertassinari merged commit 4a71e81 into mui:next Nov 8, 2020
@oliviertassinari
Copy link
Member

@mmmols It's a great first pull request on Material-UI 👌🏻. Thank you for working on it!

@mmmols
Copy link
Contributor Author

mmmols commented Nov 8, 2020

@oliviertassinari thank you for building mui-org!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: CssBaseline The React component new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Should we handle dark mode scrollbar?
4 participants