Add red theme

This commit is contained in:
Tanner Collin 2022-08-08 20:14:57 +00:00
parent 9e9571a3c0
commit 1b54342702
2 changed files with 93 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
import localForage from 'localforage'; import localForage from 'localforage';
import './Style-light.css'; import './Style-light.css';
import './Style-dark.css'; import './Style-dark.css';
import './Style-red.css';
import './fonts/Fonts.css'; import './fonts/Fonts.css';
import { ForwardDot } from './utils.js'; import { ForwardDot } from './utils.js';
import Feed from './Feed.js'; import Feed from './Feed.js';
@ -38,6 +39,11 @@ class App extends React.Component {
localStorage.setItem('theme', 'dark'); localStorage.setItem('theme', 'dark');
} }
red() {
this.setState({ theme: 'red' });
localStorage.setItem('theme', 'red');
}
componentDidMount() { componentDidMount() {
if (!this.cache.length) { if (!this.cache.length) {
localForage.iterate((value, key) => { localForage.iterate((value, key) => {
@ -49,7 +55,7 @@ class App extends React.Component {
render() { render() {
const theme = this.state.theme; const theme = this.state.theme;
document.body.style.backgroundColor = theme === 'dark' ? '#000' : '#eeeeee'; document.body.style.backgroundColor = theme ? '#000' : '#eeeeee';
return ( return (
<div className={theme}> <div className={theme}>
@ -58,7 +64,7 @@ class App extends React.Component {
<p> <p>
<Link to='/'>QotNews</Link> <Link to='/'>QotNews</Link>
<span className='theme'><a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span> <span className='theme'><a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a> - <a href='#' onClick={() => this.red()}>Red</a></span>
<br /> <br />
<span className='slogan'>Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span> <span className='slogan'>Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span>
</p> </p>

View File

@ -0,0 +1,85 @@
.red {
color: #b00;
scrollbar-color: #b00 #440000;
}
.red a {
color: #b00;
}
.red input {
color: #b00;
border: 1px solid #690000;
}
.red input::placeholder {
color: #690000;
}
.red hr {
background-color: #690000;
}
.red button {
background-color: #440000;
border-color: #b00;
color: #b00;
}
.red .item,
.red .slogan {
color: #690000;
}
.red .item .source-logo {
display: none;
}
.red .item a {
color: #690000;
}
.red .item a.link {
color: #b00;
}
.red .item a.link:visited {
color: #690000;
}
.red .item .info a.hot {
color: #cc0000;
}
.red .article a {
border-bottom: 1px solid #aa0000;
}
.red .article u {
border-bottom: 1px solid #aa0000;
text-decoration: none;
}
.red .story-text img {
filter: grayscale(100%) brightness(20%) sepia(100%) hue-rotate(-50deg) saturate(600%) contrast(0.8);
}
.red .article .info {
color: #690000;
}
.red .article .info a {
border-bottom: none;
color: #690000;
}
.red .comment.lined {
border-left: 1px solid #440000;
}
.red .toggleDot {
background-color: #440000;
}
.red .forwardDot {
background-color: #440000;
}