Skip to content

[FEATURE] Make Light Mode Less Eye Burning #31

@TheCedarPrince

Description

@TheCedarPrince

@AlphabetsAlphabets and @NTBBloodbath raised a good point that right now, the light mode is a bit jarring. I have defaulted to letting whoever access my site to run their own scripts or extensions to enable whatever sort of coloring they want, but it may be nice to have a better default. Here are some photo examples on how it could be improved:

image

This background color: #f7f3e3

image

The second uses this background color: #dddde7

For reference, here is the Franklin CSS that I can modify in the future to make things work:

/* ==================================================================
    VARIABLES
================================================================== */

:root {
    --background-color: hsl(0, 0%, 94%);
    --output-background: hsl(0, 0%, 98%);
    --small: 14px;
    --medium: 16px;
    --normal: 19px;
    --text-color: hsl(0, 0%, 20%);
}

/* ==================================================================
    DEFAULT FONT AND LAYOUT
================================================================== */

body,
html {
    font-family: Helvetica, Arial, sans-serif;
    font-size: var(--normal);
    color: var(--text-color);
    background-color:#f7f3e3;
}

/* ==================================================================
    FONT FOR CODE BLOCKS
================================================================== */

@font-face {
    font-family: JuliaMono-Medium;
    src: url("https://cdn.jsdelivr.net/gh/cormullion/juliamono/webfonts/JuliaMono-Medium.woff2");
}

/* ==================================================================
    BASIC GRID FOR PROFILE PIC
================================================================== */

.franklin-content .row {
    display: block;
}

.franklin-content .left {
    float: left;
    margin-right: 15px;
}

.franklin-content .right {
    float: right;
}

.franklin-content .container img {
    width: auto;
    padding-left: 0;
    border-radius: 10px;
}

.franklin-content .footnote {
    position: relative;
    top: -0.5em;
    font-size: 70%;
}

/* ==================================================================
    FOOT / COPYRIGHT
================================================================== */

.franklin-content .page-foot a {
    text-decoration: none;
    color: #a6a2a0;
    text-decoration: underline;
}

.page-foot {
    font-size: 80%;
    font-family: Arial, serif;
    color: #a6a2a0;
    text-align: center;
    margin-top: 6em;
    border-top: 1px solid lightgrey;
    padding-top: 2em;
    margin-bottom: 4em;
}

/* ==================================================================
    TEXT GEOMETRY
================================================================== */

.franklin-toc li {
    /* Avoid clickable elements being too close together. */
    margin: 0.6rem 0;
}

.franklin-content {
    position: relative;
    padding-left: 12.5%;
    padding-right: 12.5%;
    line-height: 1.35em;
}

/* On wide screens, fix content width to a max value. */

@media (min-width: 940px) {
    .franklin-content {
        width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* On narrow device, reduce margins. */

@media (max-width: 480px) {
    .franklin-content {
        padding-left: 6%;
        padding-right: 6%;
    }
}

/* ==================================================================
    TITLES
================================================================== */



.franklin-content {
  background: #f7f3e3;
}

.franklin-content h1 {
    font-size: 24px;
}

.franklin-content h2 {
    font-size: 22px;
}

.franklin-content h3 {
    font-size: 20px;
}

.franklin-content h1,
h2,
h3,
h4,
h5,
h6 {
    text-align: left;
}

.franklin-content h1 {
    padding-bottom: 0.5em;
    border-bottom: 3px double lightgrey;
    margin-top: 1.5em;
    margin-bottom: 1em;
}

.franklin-content h2 {
    padding-bottom: 0.3em;
    border-bottom: 1px solid lightgrey;
    margin-top: 2em;
    margin-bottom: 1em;
}

.franklin-content h1 a {
    color: inherit;
}

.franklin-content h1 a:hover {
    text-decoration: none;
}

.franklin-content h2 a {
    color: inherit;
}

.franklin-content h2 a:hover {
    text-decoration: none;
}

.franklin-content h3 a {
    color: inherit;
}

.franklin-content h3 a:hover {
    text-decoration: none;
}

.franklin-content h4 a {
    color: inherit;
}

.franklin-content h4 a:hover {
    text-decoration: none;
}

.franklin-content h5 a {
    color: inherit;
}

.franklin-content h5 a:hover {
    text-decoration: none;
}

.franklin-content h6 a {
    color: inherit;
}

.franklin-content h6 a:hover {
    text-decoration: none;
}

.franklin-content table {
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
    text-align: center;
}

.franklin-toc ol ol {
    list-style-type: lower-alpha;
}

.franklin-content th,
td {
    font-size: var(--small);
    padding: 10px;
    border: 1px solid black;
}

.franklin-content blockquote {
    background: var(--block-background);
    border-left: 7px solid #a8a8a8;
    margin: 1.5em 10px;
    padding: 0.5em 10px;
    font-style: italic;
}

.franklin-content blockquote p {
    display: inline;
}

/* ==================================================================
    GENERAL FORMATTING
================================================================== */

/* Spacing between bullet points. */

.franklin-content li p {
    margin: 10px 0;
}

.franklin-content a {
    color: #004de6;
    text-decoration: none;
}

.franklin-content a:hover {
    text-decoration: underline;
}

/* ==================================================================
    HYPERREFS AND FOOTNOTES
================================================================== */

.franklin-content .eqref a {
    color: green;
}

.franklin-content .bibref a {
    color: green;
}

.franklin-content sup {
    font-size: 70%;
    vertical-align: super;
    line-height: 0;
}

.franklin-content table.fndef {
    margin: 0;
    margin-bottom: 10px;
}

.franklin-content .fndef tr,
td {
    padding: 0;
    border: 0;
    text-align: left;
}

.franklin-content .fndef tr {
    border-left: 2px solid lightgray;
}

.franklin-content .fndef td.fndef-backref {
    vertical-align: top;
    font-size: 70%;
    padding-left: 5px;
}

.franklin-content .fndef td.fndef-content {
    font-size: 80%;
    padding-left: 10px;
    width: 100%;
}

/* ==================================================================
    IMAGES in CONTENT
================================================================== */

.franklin-content img {
    width: 95%;
    text-align: center;
    padding-left: 2.5%;
    padding-right: 2.5%;
}

.franklin-content .img-small img {
    width: 50%;
    text-align: center;
    padding-left: 20%;
}

.franklin-content .center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 80%;
}

/* ==================================================================
    KATEX
================================================================== */

body {
    counter-reset: eqnum;
}

.katex {
    font-size: 1em !important;
}

.katex-display .katex {
    /* Overwrite KaTeX settings. */
    display: inline-block;
    /* Allow display equations to wrap on small screens. */
    white-space: normal;
}

.katex-display::after {
    counter-increment: eqnum;
    content: "(" counter(eqnum) ")";
    position: relative;
    float: right;
    padding-right: 5px;
}

.nonumber .katex-display::after {
    counter-increment: nothing;
    content: "";
}

/* ==================================================================
    CODE & HIGHLIGHT.JS
================================================================== */

code {
    padding: 0.1em 0.2em;
    border-radius: 2px;
    font-size: var(--medium);
    font-family: JuliaMono-Medium;
}

/* .franklin-content code { */

/* background-color: rgba(27,31,35,0.05); */

/* padding: 0.1em 0.2em; */

/* border-radius: 2px; */

/* font-size: 90%; } */

.hljs {
    font-size: var(--small);
    line-height: 1.35em;
    border-radius: 10px;
}

.hljs-meta,
.hljs-metas,
.hljs-metap {
    font-weight: bold;
}

.hljs-meta {
    color: rgb(25, 179, 51);
}

.hljs-metas {
    color: red;
}

.hljs-metap {
    color: rgb(51, 131, 231);
}

.code-output {
    background: var(--output-background);
    border: 1px dashed #dbdbdb;
}

/* ==================================================================
    BOXES
================================================================== */

.franklin-content .colbox-blue {
    background-color: #eef3f5;
    padding-top: 5px;
    padding-right: 10px;
    padding-left: 10px;
    padding-bottom: 5px;
    margin-left: 5px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-radius: 0 10px 10px 0;
    border-left: 5px solid #4c9cf1;
}

/* ==================================================================
    DARKMODE STYLING
================================================================== */

/* 

NOTE: The following settings copy the Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) design -- additionally, credit to Fredrik Ekre for this Franklin adaptation.

*/

.darkmode--activated p,
.darkmode--activated h1,
.darkmode--activated h2,
.darkmode--activated h3,
.darkmode--activated h4,
.darkmode--activated h5,
.darkmode--activated span,
.darkmode--activated li,
.darkmode--activated td,
.darkmode--activated ol {
    color: #ECEFF4;
}

.darkmode--activated .hljs,
.darkmode--activated .franklin-content,

.darkmode--activated .hljs-subst {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #282828;
  color: #ebdbb2;
}

/* Gruvbox Red */
.darkmode--activated .hljs-deletion,
.darkmode--activated .hljs-formula,
.darkmode--activated .hljs-keyword,
.darkmode--activated .hljs-link,
.darkmode--activated .hljs-selector-tag {
  color: #fb4934;
}

/* Gruvbox Blue */
.darkmode--activated .hljs-built_in,
.darkmode--activated .hljs-emphasis,
.darkmode--activated .hljs-name,
.darkmode--activated a,
.darkmode--activated .hljs-quote,
.darkmode--activated .hljs-strong,
.darkmode--activated .hljs-title,
.darkmode--activated .hljs-variable {
  color: #83a598;
}

/* Gruvbox Yellow */
.darkmode--activated .hljs-attr,
.darkmode--activated .hljs-params,
.darkmode--activated .hljs-template-tag,
.darkmode--activated .hljs-type {
  color: #fabd2f;
}

/* Gruvbox Purple */
.darkmode--activated .hljs-builtin-name,
.darkmode--activated .hljs-doctag,
.darkmode--activated .hljs-literal,
.darkmode--activated .hljs-number {
  color: #8f3f71;
}

/* Gruvbox Orange */
.darkmode--activated .hljs-code,
.darkmode--activated .hljs-meta,
.darkmode--activated .hljs-regexp,
.darkmode--activated .hljs-selector-id,
.darkmode--activated .hljs-template-variable {
  color: #fe8019;
}

/* Gruvbox Green */
.darkmode--activated .hljs-addition,
.darkmode--activated .hljs-meta-string,
.darkmode--activated .hljs-section,
.darkmode--activated .hljs-selector-attr,
.darkmode--activated .hljs-selector-class,
.darkmode--activated .hljs-string,
.darkmode--activated .hljs-symbol {
  color: #b8bb26;
}

/* Gruvbox Aqua */
.darkmode--activated .hljs-attribute,
.darkmode--activated .hljs-bullet,
.darkmode--activated .hljs-class,
.darkmode--activated .hljs-function,
.darkmode--activated .hljs-function .hljs-keyword,
.darkmode--activated .hljs-meta-keyword,
.darkmode--activated .hljs-selector-pseudo,
.darkmode--activated .hljs-tag {
  color: #8ec07c;
}

/* Gruvbox Gray */
.darkmode--activated .hljs-comment {
  color: #928374;
}

/* Gruvbox Purple */
.darkmode--activated .hljs-link_label,
.darkmode--activated .hljs-literal,
.darkmode--activated .hljs-number {
  color: #d3869b;
}

.darkmode--activated .hljs-comment,
.darkmode--activated .hljs-emphasis {
  font-style: italic;
}

.darkmode--activated .hljs-section,
.darkmode--activated .hljs-strong,
.darkmode--activated .hljs-tag {
  font-weight: bold;
}

.darkmode--activated blockquote {
    background-color: #282828;
}

.darkmode-toggle {
    z-index: 500;
}

/* ==================================================================
    LUNR STYLING
================================================================== */

.result-title a {
    text-decoration: none;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-preview {
    color: #808080;
}

.resultCount {
    color: #808080;
}

.result-query {
    font-weight: bold;
}

#lunrSearchForm {}

Good little project to come back to someday in the future!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeatureFeature request for website

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions