Make progress on CSS for detail view for dark mode.

This commit is contained in:
Brent Simmons 2018-07-21 19:55:07 -07:00
parent 6c3a104bca
commit 0c1fc37aa9
3 changed files with 50 additions and 25 deletions

View File

@ -453,7 +453,7 @@ class ArticleRenderer {
"""
s += "\n\n</head><body onload='startup()'>\n\n"
s += "\n\n</head><body onload='startup()' class=dark>\n\n"
s += RSMacroProcessor.renderedText(withTemplate: template(), substitutions: substitutions(), macroStart: "[[", macroEnd: "]]")

View File

@ -249,11 +249,11 @@ final class DetailContainerView: NSView {
weak var viewController: DetailViewController? = nil
private var didConfigureLayer = false
override var wantsUpdateLayer: Bool {
return true
}
// private var didConfigureLayer = false
//
// override var wantsUpdateLayer: Bool {
// return true
// }
var contentView: NSView? {
didSet {
@ -278,17 +278,21 @@ final class DetailContainerView: NSView {
viewController?.viewDidEndLiveResize()
}
override func updateLayer() {
guard !didConfigureLayer else {
return
}
if let layer = layer {
let color = appDelegate.currentTheme.color(forKey: "MainWindow.Detail.backgroundColor")
layer.backgroundColor = color.cgColor
didConfigureLayer = true
}
override func draw(_ dirtyRect: NSRect) {
NSColor.textBackgroundColor.setFill()
dirtyRect.fill()
}
// override func updateLayer() {
//
// guard !didConfigureLayer else {
// return
// }
// if let layer = layer {
// let color = appDelegate.currentTheme.color(forKey: "MainWindow.Detail.backgroundColor")
// layer.backgroundColor = color.cgColor
// didConfigureLayer = true
// }
// }
}
// MARK: -

View File

@ -1,6 +1,4 @@
body {
color: #444;
background-color: white;
margin-top: 20px;
margin-bottom: 64px;
margin-left: 64px;
@ -8,30 +6,53 @@ body {
font-family: -apple-system;
font-size: 18px;
}
a {
text-decoration: none;
}
a, a:link, a:visited {
color: #416ED2;
}
a:hover {
text-decoration: underline;
}
.feedlink {
font-weight: bold;
}
.headerTable {
width: 100%;
height: 68px;
}
/* Light mode */
body.light {
color: -webkit-text;
background-color: -apple-system-text-background;
}
body.light a, body.light a:link, body.light a:visited {
color: -apple-system-blue;
}
body.light .headerTable {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
/* Dark mode */
body.dark {
color: #d2d2d2;
background-color: #2d2d2d;
}
body.dark a, body.dark a:link, body.dark a:visited {
color: #4490e2;
}
body.dark .headerTable {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.header a:link, .header a:visited {
color: rgba(0, 0, 0, 0.3);
}
.header {
color: rgba(0, 0, 0, 0.3);
}
.feedlink {
font-weight: bold;
}
.feedlink a:link, .feedlink a:visited {
color: rgba(0, 0, 0, 0.6);
}