Code element styling
Customized font stack, along with base styling (needs tweaks).
This commit is contained in:
parent
cafca8806f
commit
84ba6748b3
4 changed files with 140 additions and 8 deletions
91
dist/mini-default.css
vendored
91
dist/mini-default.css
vendored
|
@ -1,3 +1,4 @@
|
|||
@charset "UTF-8";
|
||||
/*
|
||||
Flavor name: Default (mini-default)
|
||||
Author: Angelos Chalaris (chalarangelo@gmail.com)
|
||||
|
@ -12,8 +13,15 @@
|
|||
--fore-color: #212121;
|
||||
--secondary-fore-color: #424242;
|
||||
--back-color: #f8f8f8;
|
||||
--secondary-back-color: #e6e6e6;
|
||||
--blockquote-color: #f57c00;
|
||||
--pre-color: #1565c0;
|
||||
--border-color: #acacac;
|
||||
--secondary-border-color: #c9c9c9;
|
||||
--heading-ratio: 1.19;
|
||||
--side-margin: 0.5rem;
|
||||
--universal-margin: 0.5rem;
|
||||
--universal-padding: 0.5rem;
|
||||
--universal-border-radius: 0.125rem;
|
||||
}
|
||||
|
||||
html {
|
||||
|
@ -60,7 +68,7 @@ img {
|
|||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
line-height: 1.2;
|
||||
margin: calc(1.5 * var(--side-margin)) var(--side-margin);
|
||||
margin: calc(1.5 * var(--universal-margin)) var(--universal-margin);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
@ -93,3 +101,82 @@ h5 {
|
|||
h6 {
|
||||
font-size: calc(1rem / var(--heading-ratio));
|
||||
}
|
||||
|
||||
p {
|
||||
margin: var(--universal-margin);
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
margin: var(--universal-margin);
|
||||
padding-left: calc(2 * var(--universal-margin));
|
||||
}
|
||||
|
||||
b, strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
border: 0;
|
||||
line-height: 1.25em;
|
||||
margin: var(--universal-margin);
|
||||
height: 0.0625rem;
|
||||
background: linear-gradient(to right, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
|
||||
}
|
||||
|
||||
blockquote {
|
||||
display: block;
|
||||
position: relative;
|
||||
font-style: italic;
|
||||
color: var(--secondary-fore-color);
|
||||
margin: var(--universal-margin);
|
||||
padding: calc(3 * var(--universal-padding));
|
||||
border: 0.0625rem solid var(--secondary-border-color);
|
||||
border-left: 0.375rem solid var(--blockquote-color);
|
||||
border-radius: 0 var(--universal-border-radius) var(--universal-border-radius) 0;
|
||||
}
|
||||
|
||||
blockquote:before {
|
||||
position: absolute;
|
||||
top: calc(0rem - var(--universal-padding));
|
||||
left: 0;
|
||||
font-family: sans-serif;
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
content: "\201c";
|
||||
color: var(--blockquote-color);
|
||||
}
|
||||
|
||||
blockquote[cite]:after {
|
||||
font-style: normal;
|
||||
font-size: 0.75em;
|
||||
font-weight: 700;
|
||||
content: "\a— " attr(cite);
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
code, kbd, pre, samp {
|
||||
font-family: Menlo, Consolas, monospace;
|
||||
}
|
||||
|
||||
code {
|
||||
background: var(--secondary-back-color);
|
||||
border-radius: var(--universal-border-radius);
|
||||
padding: calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2);
|
||||
}
|
||||
|
||||
kbd {
|
||||
background: var(--fore-color);
|
||||
color: var(--back-color);
|
||||
border-radius: var(--universal-border-radius);
|
||||
padding: calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2);
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow: auto;
|
||||
background: var(--secondary-back-color);
|
||||
padding: calc(1.5 * var(--universal-padding));
|
||||
margin: var(--universal-margin);
|
||||
border: 0.0625rem solid var(--secondary-border-color);
|
||||
border-left: 0.25rem solid var(--pre-color);
|
||||
}
|
||||
|
|
2
dist/mini-default.min.css
vendored
2
dist/mini-default.min.css
vendored
|
@ -1 +1 @@
|
|||
:root{--fore-color:#212121;--secondary-fore-color:#424242;--back-color:#f8f8f8;--heading-ratio:1.19;--side-margin:.5rem}html{font-size:16px}html,*{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Helvetica, sans-serif;line-height:1.5;-webkit-text-size-adjust:100%}*{font-size:1rem}body{margin:0;color:var(--fore-color);background:var(--back-color)}details{display:block}summary{display:list-item}abbr[title]{border-bottom:none;text-decoration:underline dotted}input{overflow:visible}img{max-width:100%;height:auto}h1,h2,h3,h4,h5,h6{line-height:1.2;margin:calc(1.5 * var(--side-margin)) var(--side-margin);font-weight:500}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{color:var(--secondary-fore-color);display:block;margin-top:-.25rem}h1{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio))}h2{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio))}h3{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio))}h4{font-size:calc(1rem * var(--heading-ratio))}h5{font-size:1rem}h6{font-size:calc(1rem / var(--heading-ratio))}
|
||||
:root{--fore-color:#212121;--secondary-fore-color:#424242;--back-color:#f8f8f8;--secondary-back-color:#e6e6e6;--blockquote-color:#f57c00;--pre-color:#1565c0;--border-color:#acacac;--secondary-border-color:#c9c9c9;--heading-ratio:1.19;--universal-margin:.5rem;--universal-padding:.5rem;--universal-border-radius:.125rem}html{font-size:16px}html,*{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Helvetica, sans-serif;line-height:1.5;-webkit-text-size-adjust:100%}*{font-size:1rem}body{margin:0;color:var(--fore-color);background:var(--back-color)}details{display:block}summary{display:list-item}abbr[title]{border-bottom:none;text-decoration:underline dotted}input{overflow:visible}img{max-width:100%;height:auto}h1,h2,h3,h4,h5,h6{line-height:1.2;margin:calc(1.5 * var(--universal-margin)) var(--universal-margin);font-weight:500}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{color:var(--secondary-fore-color);display:block;margin-top:-.25rem}h1{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio))}h2{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio) * var(--heading-ratio))}h3{font-size:calc(1rem * var(--heading-ratio) * var(--heading-ratio))}h4{font-size:calc(1rem * var(--heading-ratio))}h5{font-size:1rem}h6{font-size:calc(1rem / var(--heading-ratio))}p{margin:var(--universal-margin)}ol,ul{margin:var(--universal-margin);padding-left:calc(2 * var(--universal-margin))}b,strong{font-weight:700}hr{box-sizing:content-box;border:0;line-height:1.25em;margin:var(--universal-margin);height:.0625rem;background:linear-gradient(to right, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent)}blockquote{display:block;position:relative;font-style:italic;color:var(--secondary-fore-color);margin:var(--universal-margin);padding:calc(3 * var(--universal-padding));border:.0625rem solid var(--secondary-border-color);border-left:.375rem solid var(--blockquote-color);border-radius:0 var(--universal-border-radius) var(--universal-border-radius) 0}blockquote:before{position:absolute;top:calc(0rem - var(--universal-padding));left:0;font-family:sans-serif;font-size:3rem;font-weight:700;content:"\201c";color:var(--blockquote-color)}blockquote[cite]:after{font-style:normal;font-size:.75em;font-weight:700;content:"\a— " attr(cite);white-space:pre}code,kbd,pre,samp{font-family:Menlo, Consolas, monospace}code{background:var(--secondary-back-color);border-radius:var(--universal-border-radius);padding:calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2)}kbd{background:var(--fore-color);color:var(--back-color);border-radius:var(--universal-border-radius);padding:calc(var(--universal-padding) / 4) calc(var(--universal-padding) / 2)}pre{overflow:auto;background:var(--secondary-back-color);padding:calc(1.5 * var(--universal-padding));margin:var(--universal-margin);border:.0625rem solid var(--secondary-border-color);border-left:.25rem solid var(--pre-color)}
|
||||
|
|
|
@ -35,3 +35,10 @@
|
|||
- The old *fancy style* of `hr` is now the default and only styling choice. Seems easier that way. Manual tweaking can resolve this for certain flavors.
|
||||
- Added `--border-color` to use for universal border colors.
|
||||
- Applied a new gradient style to `hr`, one that uses `transparent` and the `--border-color`. Hopefully, it works as expected.
|
||||
- Completely remodelled the `blockquote` element, using CSS variables, a cleaner styling and some extra tricks. It should now behave better when there is no `[cite]` attribute present, improving presentation.
|
||||
- After a couple hours of research on web safe monospaced fonts and fonts that are actually up-to-date, a cup of coffe and a terrible headache, I ended up with the shortest possible `font-family` native font stack for monospaced fonts for `code, pre, kbd`. The only useful article was [this](https://www.client9.com/css-system-font-stack---monospace-v1/), due to the fact that it was posted in the last year. Honestly, the last version used just `monospace`, worst-case scenario there is no improvement whatsoever, but at least I tried. Preliminary results show that this looks pretty decent on Windows.
|
||||
- `box-shadow` has been dropped entirely for now, it will be added at a later time during a later alpha. For now, I want a quick and dirty solution for the most part.
|
||||
- Quick and dirty `code` and `kbd` element implementation, tweaks might be required later down the line.
|
||||
- `pre` element styling now has a sidebar by default and uses a CSS variable for this.
|
||||
- `samp` element styling removed (at least for now).
|
||||
- Tested and debugged code up to this point.
|
||||
|
|
|
@ -13,7 +13,9 @@ $_body-margin: 0 !default; // [Hidden] Margin for body
|
|||
$fore-color: #212121 !default; // Text & foreground color
|
||||
$secondary-fore-color: #424242 !default; // Secondary text & foreground color
|
||||
$back-color: #f8f8f8 !default; // Background color
|
||||
$secondary-back-color: #e6e6e6 !default; // Secondary background color
|
||||
$blockquote-color: #f57c00 !default; // <blockquote> sidebar and quotation color
|
||||
$pre-color: #1565c0 !default; // <pre> sidebar color
|
||||
$border-color: #acacac !default; // Border color
|
||||
$secondary-border-color: #c9c9c9 !default; // Secondary border color
|
||||
$heading-line-height: 1.2 !default; // Line height for headings
|
||||
|
@ -21,6 +23,7 @@ $heading-ratio: 1.19 !default; // Ratio for headings (strictly
|
|||
$subheading-font-size: 0.75em !default; // Font sizing for <small> elements in headings
|
||||
$subheading-top-margin: -0.25rem !default; // Top margin of <small> elements in headings
|
||||
$universal-margin: 0.5rem !default; // Universal margin for the most elements
|
||||
$universal-padding: 0.5rem !default; // Universal padding for the most elements
|
||||
$universal-border-radius: 0.125rem !default; // Universal border-radius for most elements
|
||||
$small-font-size: 0.75em !default; // Font sizing for <small> elements
|
||||
$heading-font-weight: 500 !default; // Font weight for headings
|
||||
|
@ -28,26 +31,33 @@ $bold-font-weight: 700; // Font weight for <b> and <stro
|
|||
$horizontal-rule-line-height: 1.25em; // <hr> line height
|
||||
$blockquote-quotation-size: 3rem; // Font size for the quotation of <blockquote>
|
||||
$blockquote-cite-size: 0.75em; // Font size for the [cite] of <blockquote>
|
||||
$code-font-family: 'Menlo, Consolas, monospace' !default; // Font stack for code elements
|
||||
// CSS variable name definitions [exercise caution if modifying these]
|
||||
$fore-color-var: '--fore-color';
|
||||
$secondary-fore-color-var: '--secondary-fore-color';
|
||||
$back-color-var: '--back-color';
|
||||
$secondary-back-color-var: '--secondary-back-color';
|
||||
$blockquote-color-var: '--blockquote-color';
|
||||
$pre-color-var: '--pre-color';
|
||||
$border-color-var: '--border-color';
|
||||
$secondary-border-color-var: '--secondary-border-color';
|
||||
$heading-ratio-var: '--heading-ratio';
|
||||
$universal-margin-var: '--universal-margin';
|
||||
$universal-padding-var: '--universal-padding';
|
||||
$universal-border-radius-var: '--universal-border-radius';
|
||||
/* Core module CSS variable definitions */
|
||||
:root {
|
||||
#{$fore-color-var}: $fore-color;
|
||||
#{$secondary-fore-color-var}: $secondary-fore-color;
|
||||
#{$back-color-var}: $back-color;
|
||||
#{$secondary-back-color-var}: $secondary-back-color;
|
||||
#{$blockquote-color-var}: $blockquote-color;
|
||||
#{$pre-color-var}: $pre-color;
|
||||
#{$border-color-var}: $border-color;
|
||||
#{$secondary-border-color-var}: $secondary-border-color;
|
||||
#{$heading-ratio-var}: $heading-ratio;
|
||||
#{$universal-margin-var}: $universal-margin;
|
||||
#{$universal-padding-var}: $universal-padding;
|
||||
#{$universal-border-radius-var}: $universal-border-radius;
|
||||
}
|
||||
html {
|
||||
|
@ -162,23 +172,23 @@ hr {
|
|||
// Actual styling using variables
|
||||
line-height: $horizontal-rule-line-height;
|
||||
margin: var(#{$universal-margin-var});
|
||||
height: $_1px;
|
||||
background: linear-gradient(transparent, var(#{$border-color-var}) 20%, var(#{$border-color-var}) 80%, transparent);
|
||||
height: $__1px;
|
||||
background: linear-gradient(to right, transparent, var(#{$border-color-var}) 20%, var(#{$border-color-var}) 80%, transparent);
|
||||
}
|
||||
|
||||
blockquote { // Doesn't have a back color yet...
|
||||
blockquote { // Doesn't have a back color yet, as well as no shadow...
|
||||
display: block;
|
||||
position: relative;
|
||||
font-style: italic;
|
||||
color: var(#{$secondary-fore-color-var});
|
||||
margin: var(#{$universal-margin-var});
|
||||
padding: calc(3 * var(#{$universal-margin-var}));
|
||||
padding: calc(3 * var(#{$universal-padding-var}));
|
||||
border: $__1px solid var(#{$secondary-border-color-var});
|
||||
border-left: 6*$__1px solid var(#{$blockquote-color-var});
|
||||
border-radius: 0 var(#{$universal-border-radius-var}) var(#{$universal-border-radius-var}) 0;
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: calc(0rem - var(#{$universal-padding-var}));
|
||||
left: 0;
|
||||
font-family: sans-serif;
|
||||
font-size: $blockquote-quotation-size;
|
||||
|
@ -194,3 +204,31 @@ blockquote { // Doesn't have a back color yet...
|
|||
white-space: pre;
|
||||
}
|
||||
}
|
||||
|
||||
code, kbd, pre, samp{
|
||||
font-family: #{$code-font-family}; // Display fix should be applied manually!
|
||||
}
|
||||
|
||||
code { // No border color yet and fore color is the default, as well as no shadow...
|
||||
background: var(#{$secondary-back-color-var});
|
||||
border-radius: var(#{$universal-border-radius-var});
|
||||
// This could be a bit counterintuitive and burden the codebase a bit, look into it again?
|
||||
padding: calc(var(#{$universal-padding-var}) / 4) calc(var(#{$universal-padding-var}) / 2);
|
||||
}
|
||||
|
||||
kbd { // No border color yet and no shadow, colors might want to be tweaked a bit...
|
||||
background: var(#{$fore-color-var});
|
||||
color: var(#{$back-color-var});
|
||||
border-radius: var(#{$universal-border-radius-var});
|
||||
// This could be a bit counterintuitive and burden the codebase a bit, look into it again?
|
||||
padding: calc(var(#{$universal-padding-var}) / 4) calc(var(#{$universal-padding-var}) / 2);
|
||||
}
|
||||
|
||||
pre { // Fore color is the default, as well as no shadow...
|
||||
overflow: auto; // Responsiveness
|
||||
background: var(#{$secondary-back-color-var});
|
||||
padding: calc(1.5 * var(#{$universal-padding-var}));
|
||||
margin: var(#{$universal-margin-var});
|
||||
border: $__1px solid var(#{$secondary-border-color-var});
|
||||
border-left: 4*$__1px solid var(#{$pre-color-var});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue