scrollbar theme
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { ThemeProvider } from 'styled-components';
|
import { ThemeProvider, createGlobalStyle } from 'styled-components';
|
||||||
import ls from 'local-storage';
|
import ls from 'local-storage';
|
||||||
|
|
||||||
import EditorControls from './EditorControls';
|
import EditorControls from './EditorControls';
|
||||||
@@ -35,6 +35,7 @@ export default function Editor({ content, setContent, contentType }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ThemeProvider theme={themes[theme]}>
|
<ThemeProvider theme={themes[theme]}>
|
||||||
|
<EditorGlobalStyle />
|
||||||
<EditorControls
|
<EditorControls
|
||||||
code={content}
|
code={content}
|
||||||
setCode={setContent}
|
setCode={setContent}
|
||||||
@@ -55,6 +56,14 @@ export default function Editor({ content, setContent, contentType }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const EditorGlobalStyle = createGlobalStyle`
|
||||||
|
html, body {
|
||||||
|
color-scheme: ${props => props.theme.lightOrDark};
|
||||||
|
scrollbar-color: ${props => props.theme.lightOrDark};
|
||||||
|
background-color: ${props => props.theme.editor.background};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
// hook used to load "preference" settings from local storage, or fall back to a default value.
|
// hook used to load "preference" settings from local storage, or fall back to a default value.
|
||||||
function usePreference(id, defaultValue, valid) {
|
function usePreference(id, defaultValue, valid) {
|
||||||
const [value, setValue] = useState(() => {
|
const [value, setValue] = useState(() => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const themes = {
|
|||||||
primary: '#aaddff',
|
primary: '#aaddff',
|
||||||
secondary: '#022550',
|
secondary: '#022550',
|
||||||
highlight: '#36368c',
|
highlight: '#36368c',
|
||||||
|
lightOrDark: 'light',
|
||||||
|
|
||||||
editor: {
|
editor: {
|
||||||
background: 'none',
|
background: 'none',
|
||||||
@@ -31,6 +32,7 @@ const themes = {
|
|||||||
primary: '#022550',
|
primary: '#022550',
|
||||||
secondary: '#aaddff',
|
secondary: '#aaddff',
|
||||||
highlight: '#77c8f9',
|
highlight: '#77c8f9',
|
||||||
|
lightOrDark: 'dark',
|
||||||
|
|
||||||
editor: {
|
editor: {
|
||||||
background: '#041f29',
|
background: '#041f29',
|
||||||
@@ -59,6 +61,7 @@ const themes = {
|
|||||||
primary: '#c9d1d9', // fg.default
|
primary: '#c9d1d9', // fg.default
|
||||||
secondary: '#010409', // canvas.inset
|
secondary: '#010409', // canvas.inset
|
||||||
highlight: '#161b22', // canvas.overlay
|
highlight: '#161b22', // canvas.overlay
|
||||||
|
lightOrDark: 'dark',
|
||||||
|
|
||||||
editor: {
|
editor: {
|
||||||
background: '#0d1117', // canvas.default
|
background: '#0d1117', // canvas.default
|
||||||
|
|||||||
Reference in New Issue
Block a user