Closed ianzapolsky closed 10 years ago
A good attempt! Alas, there are some issues with the way you've done things:
dark-theme
is, IMO, too prone to collisions with site styles. I'd prefer sr-dark
or something.sr-dark
class to the sr-reader
element. This lets us write dark styles for individual elements and to easily see the difference between light and dark. e.g..sr-reader .sr-word-box {
flex: 0 0 auto;
width: 400px;
background: white;
position: relative;
}
.sr-reader.sr-dark .sr-word-box {
background-color: black;
}
Reader
class, you should use a config variable "dark" with a default value of false, then the toggleTheme
function wouldn't be coupled to the reader, and the user's choice would be saved for future use. e.g.function toggleTheme () {
config("dark", !config("dark"));
reader && reader.applyTheme();
}
where applyTheme
does something like:
if (config("dark")) addClass(box, "sr-dark");
else removeClass(box. "sr-dark");
and should be called at Reader
construction time.
I hope none of this sounds too critical, and greatly appreciate your will to contribute :)
thanks for the detailed notes! I'll rework things and see if I can't hit it better the second time.
Implemented a dark theme for the jetzt speedreader