From 3d58adc2630083be70b3bc2acf4a63c9a9016b7b Mon Sep 17 00:00:00 2001 From: "Mohammad M. Ramezanpour" Date: Fri, 6 Oct 2023 17:40:44 +0200 Subject: [PATCH] Add dark mode according to the system settings --- Gemfile.lock | 10 +- css/highlight-dark.css | 193 ++++++++++++++++++++++++ css/{github.css => highlight-light.css} | 0 css/ramezanpour.css | 34 ++++- 4 files changed, 227 insertions(+), 10 deletions(-) create mode 100644 css/highlight-dark.css rename css/{github.css => highlight-light.css} (100%) diff --git a/Gemfile.lock b/Gemfile.lock index 84c2b06..7a1b132 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,12 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.7.2) + activesupport (6.1.7.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) coffee-script (2.4.1) @@ -205,14 +206,12 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) - mini_portile2 (2.8.4) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.19.0) - nokogiri (1.15.4) - mini_portile2 (~> 2.8.2) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) @@ -250,9 +249,10 @@ GEM unf_ext (0.0.8.2) unicode-display_width (1.8.0) webrick (1.8.1) + zeitwerk (2.6.12) PLATFORMS - ruby + arm64-darwin-21 DEPENDENCIES github-pages diff --git a/css/highlight-dark.css b/css/highlight-dark.css new file mode 100644 index 0000000..776012e --- /dev/null +++ b/css/highlight-dark.css @@ -0,0 +1,193 @@ +.highlight pre { + background-color: #272822; +} +.highlight .hll { + background-color: #272822; +} +.highlight .c { + color: #75715e; +} /* Comment */ +.highlight .err { + color: #960050; + background-color: #1e0010; +} /* Error */ +.highlight .k { + color: #66d9ef; +} /* Keyword */ +.highlight .l { + color: #ae81ff; +} /* Literal */ +.highlight .n { + color: #f8f8f2; +} /* Name */ +.highlight .o { + color: #f92672; +} /* Operator */ +.highlight .p { + color: #f8f8f2; +} /* Punctuation */ +.highlight .cm { + color: #75715e; +} /* Comment.Multiline */ +.highlight .cp { + color: #75715e; +} /* Comment.Preproc */ +.highlight .c1 { + color: #75715e; +} /* Comment.Single */ +.highlight .cs { + color: #75715e; +} /* Comment.Special */ +.highlight .ge { + font-style: italic; +} /* Generic.Emph */ +.highlight .gs { + font-weight: bold; +} /* Generic.Strong */ +.highlight .kc { + color: #66d9ef; +} /* Keyword.Constant */ +.highlight .kd { + color: #66d9ef; +} /* Keyword.Declaration */ +.highlight .kn { + color: #f92672; +} /* Keyword.Namespace */ +.highlight .kp { + color: #66d9ef; +} /* Keyword.Pseudo */ +.highlight .kr { + color: #66d9ef; +} /* Keyword.Reserved */ +.highlight .kt { + color: #66d9ef; +} /* Keyword.Type */ +.highlight .ld { + color: #e6db74; +} /* Literal.Date */ +.highlight .m { + color: #ae81ff; +} /* Literal.Number */ +.highlight .s { + color: #e6db74; +} /* Literal.String */ +.highlight .na { + color: #a6e22e; +} /* Name.Attribute */ +.highlight .nb { + color: #f8f8f2; +} /* Name.Builtin */ +.highlight .nc { + color: #a6e22e; +} /* Name.Class */ +.highlight .no { + color: #66d9ef; +} /* Name.Constant */ +.highlight .nd { + color: #a6e22e; +} /* Name.Decorator */ +.highlight .ni { + color: #f8f8f2; +} /* Name.Entity */ +.highlight .ne { + color: #a6e22e; +} /* Name.Exception */ +.highlight .nf { + color: #a6e22e; +} /* Name.Function */ +.highlight .nl { + color: #f8f8f2; +} /* Name.Label */ +.highlight .nn { + color: #f8f8f2; +} /* Name.Namespace */ +.highlight .nx { + color: #a6e22e; +} /* Name.Other */ +.highlight .py { + color: #f8f8f2; +} /* Name.Property */ +.highlight .nt { + color: #f92672; +} /* Name.Tag */ +.highlight .nv { + color: #f8f8f2; +} /* Name.Variable */ +.highlight .ow { + color: #f92672; +} /* Operator.Word */ +.highlight .w { + color: #f8f8f2; +} /* Text.Whitespace */ +.highlight .mf { + color: #ae81ff; +} /* Literal.Number.Float */ +.highlight .mh { + color: #ae81ff; +} /* Literal.Number.Hex */ +.highlight .mi { + color: #ae81ff; +} /* Literal.Number.Integer */ +.highlight .mo { + color: #ae81ff; +} /* Literal.Number.Oct */ +.highlight .sb { + color: #e6db74; +} /* Literal.String.Backtick */ +.highlight .sc { + color: #e6db74; +} /* Literal.String.Char */ +.highlight .sd { + color: #e6db74; +} /* Literal.String.Doc */ +.highlight .s2 { + color: #e6db74; +} /* Literal.String.Double */ +.highlight .se { + color: #ae81ff; +} /* Literal.String.Escape */ +.highlight .sh { + color: #e6db74; +} /* Literal.String.Heredoc */ +.highlight .si { + color: #e6db74; +} /* Literal.String.Interpol */ +.highlight .sx { + color: #e6db74; +} /* Literal.String.Other */ +.highlight .sr { + color: #e6db74; +} /* Literal.String.Regex */ +.highlight .s1 { + color: #e6db74; +} /* Literal.String.Single */ +.highlight .ss { + color: #e6db74; +} /* Literal.String.Symbol */ +.highlight .bp { + color: #f8f8f2; +} /* Name.Builtin.Pseudo */ +.highlight .vc { + color: #f8f8f2; +} /* Name.Variable.Class */ +.highlight .vg { + color: #f8f8f2; +} /* Name.Variable.Global */ +.highlight .vi { + color: #f8f8f2; +} /* Name.Variable.Instance */ +.highlight .il { + color: #ae81ff; +} /* Literal.Number.Integer.Long */ + +.highlight .gh { +} /* Generic Heading & Diff Header */ +.highlight .gu { + color: #75715e; +} /* Generic.Subheading & Diff Unified/Comment? */ +.highlight .gd { + color: #f92672; +} /* Generic.Deleted & Diff Deleted */ +.highlight .gi { + color: #a6e22e; +} /* Generic.Inserted & Diff Inserted */ diff --git a/css/github.css b/css/highlight-light.css similarity index 100% rename from css/github.css rename to css/highlight-light.css diff --git a/css/ramezanpour.css b/css/ramezanpour.css index eef6f90..738f6ad 100644 --- a/css/ramezanpour.css +++ b/css/ramezanpour.css @@ -1,9 +1,33 @@ -@import "github.css"; +@import "highlight-light.css" (prefers-color-scheme: light); +@import "highlight-dark.css" (prefers-color-scheme: dark); :root { --first: #145da0; --second: #2e8bc0; --black: #333; + --code: #f5f5f5; +} + +@media (prefers-color-scheme: dark) { + body { + background-color: #111; + color: var(--black); + } + :root { + --first: #17b890; + --second: #9dc5bb; + --black: #ccc; + --code: #222; + } +} + +h1, +h2, +h3, +h4, +h5, +h6 { + color: var(--black); } .container { @@ -84,7 +108,7 @@ h1 a:hover { .content pre { padding: 10px; border-radius: 5px; - background-color: #f5f5f5; + background-color: var(--code); } pre { @@ -94,7 +118,7 @@ pre { } code { - background-color: #f5f5f5; + background-color: var(--code); border-radius: 3px; padding: 3px; font-size: 120%; @@ -122,9 +146,9 @@ footer.main-footer { blockquote { padding-left: 7px; - border-left: 3px solid #777; + border-left: 3px solid var(--first); font-style: italic; - color: #777; + color: var(--black); } .home {