Skip to content

Commit

Permalink
chore: tweak scrollbar color with theme
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers committed Jul 9, 2024
1 parent 372c841 commit 2ee5833
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions modules/ui_gradio_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def stylesheet(fn):
dark = resolve_var('background_fill_primary_dark')
head += f'<style>html {{ background-color: {light}; }} @media (prefers-color-scheme: dark) {{ html {{background-color: {dark}; }} }}</style>'

light_text = resolve_var('body_text_color')
dark_text = resolve_var('body_text_color_dark')
head += f'<style>html {{ --body-background-fill: {light}; --body-text-color: {light_text}; }} html:has(body.dark) {{ --body-background-fill: {dark}; --body-text-color: {dark_text}; }}</style>'

return head


Expand Down
11 changes: 4 additions & 7 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ div.gradio-image button[aria-label="Edit"] {
}


html:has(body.dark) {
/**
* The CSS variables --body-background-fill and --body-text-color are not apply to the HTML element with the dark theme
*/
/* scrollbar-color: var(--body-text-color) var(--body-background-fill) */
scrollbar-color: #f3f4f6 #0b0f19;
html {
scrollbar-color: var(--body-text-color) var(--body-background-fill)
}

body {
background: var(--body-background-fill, #0b0f19);
background: var(--body-background-fill);
color: var(--body-text-color);
}

.block.padded:not(.gradio-accordion) {
Expand Down

0 comments on commit 2ee5833

Please sign in to comment.