-
Notifications
You must be signed in to change notification settings - Fork 155
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
fix search icon contrast issues #730
Conversation
webui/src/default/theme.tsx
Outdated
@@ -28,7 +28,7 @@ export default function createDefaultTheme(themeType: 'light' | 'dark'): Theme { | |||
return createMuiTheme({ | |||
palette: { | |||
primary: { | |||
main: themeType === 'dark' ? '#eeeeee' : '#444', | |||
main: themeType === 'dark' ? '#111111' : '#ffffff', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one-liner! I hope this won't have unintended consequences 😄
Is there a way to maybe make a new Theme just for that one search component? I think if we changed it here we'd have to test the whole Web UI for color changes and side-effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment!
Let me see if there's a way to separate the theme for this component. I'm thinking maybe I should create a new theme and apply it to the search icon button individually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be the better option here indeed. Looping in @amvanbaren, maybe you have some ideas :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the main issue has already been fixed.
There are 2 more things I noticed:
- You don't have to pass
themeType
through props. You can useconst { pageSettings } = useContext(MainContext);
instead. For example:const { pageSettings, service, user, handleError } = useContext(MainContext); - You can define style classes instead of using inline styles, e.g. iconButtonLight and iconButtonDark.
openvsx/webui/src/pages/extension-list/extension-list-searchfield.tsx
Lines 29 to 37 in 5df9b74
iconButton: { backgroundColor: theme.palette.secondary.main, borderRadius: '0 4px 4px 0', padding: theme.spacing(1), transition: 'all 0s', '&:hover': { filter: 'invert(100%)', } },
And then you can use it like this:
openvsx/webui/src/pages/extension-detail/extension-detail.tsx
Lines 348 to 352 in 5df9b74
const classes = this.props.classes; const warningClass = themeType === 'dark' ? classes.warningDark : classes.warningLight; const themeClass = themeType === 'dark' ? classes.darkTheme : classes.lightTheme; if (!extension.verified) { return <Paper className={`${classes.banner} ${warningClass} ${themeClass}`}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks way better! One nitpick: you can replace
const prefersDarkMode = pageSettings?.themeType === 'dark' ? true : false;
with
const searchIconClass = pageSettings?.themeType === 'dark' ? classes.searchIconDark : classes.searchIconLight;
and then use that to style the SearchIcon
, so that you only have one ternary (condition ? x : y
) statement.
@filiptronicek Does it fix the contrast issues?
The contrast issues are solved. |
Ok, LGTM. @yiningwang11 can you squash your commits, so that this PR gets merged into master as 1 commit? |
Hello @amvanbaren ,
I noticed that there must be something wrong with my process because the commits on this branch are not being squashed and the message I got above is clearly not what I expected. |
@yiningwang11 Luckily you haven't pushed Then you should rebase the last 5 commits ( You can see your list of commits here: https://github.com/eclipse/openvsx/pull/730/commits. |
Hello @amvanbaren , |
…d and unhovered, using MainContext & defining style classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix #660
I modified the theme colour of the search icon, now it looks like this: