pico/scss/content/_code.scss

94 lines
1.7 KiB
SCSS
Raw Normal View History

2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2019-11-27 15:31:49 +07:00
/**
* Code
*/
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
2022-03-06 10:53:20 +07:00
// - sanitize.css v13.0.0 | CC0 1.0 Universal | github.com/csstools/sanitize.css
2019-11-27 15:31:49 +07:00
//
// 1. Correct the inheritance and scaling of font size in all browsers
2022-03-06 10:53:20 +07:00
// 2. Correct the odd `em` font sizing in all browsers
2019-11-27 15:31:49 +07:00
pre,
code,
kbd,
samp {
2021-11-08 00:12:34 +07:00
font-size: 0.875em; // 2
2022-10-22 13:11:51 +07:00
font-family: var(#{$}font-family); // 1
2019-11-27 15:31:49 +07:00
}
// Prevent overflow of the container in all browsers (opinionated)
pre {
-ms-overflow-style: scrollbar;
overflow: auto;
}
2019-11-27 15:31:49 +07:00
// Pico
//
pre,
code,
kbd {
2022-10-22 13:11:51 +07:00
border-radius: var(#{$}border-radius);
background: var(#{$}code-background-color);
color: var(#{$}code-color);
font-weight: var(#{$}font-weight);
line-height: initial;
2021-10-23 17:28:31 +07:00
}
2019-11-27 15:31:49 +07:00
code,
kbd {
display: inline-block;
2021-10-24 12:33:20 +07:00
padding: 0.375rem 0.5rem;
2019-11-27 15:31:49 +07:00
}
pre {
display: block;
2022-10-22 13:11:51 +07:00
margin-bottom: var(#{$}spacing);
2019-11-27 15:31:49 +07:00
overflow-x: auto;
> code {
display: block;
2022-10-22 13:11:51 +07:00
padding: var(#{$}spacing);
2022-03-06 10:53:20 +07:00
background: none;
2019-11-27 15:31:49 +07:00
font-size: 14px;
2022-10-22 13:11:51 +07:00
line-height: var(#{$}line-height);
2019-11-27 15:31:49 +07:00
}
}
2021-07-02 16:54:41 +07:00
// Code Syntax
2019-11-27 15:31:49 +07:00
code {
// Tags
b {
2022-10-22 13:11:51 +07:00
color: var(#{$}code-tag-color);
font-weight: var(#{$}font-weight);
2019-11-27 15:31:49 +07:00
}
// Properties
i {
2022-10-22 13:11:51 +07:00
color: var(#{$}code-property-color);
2019-11-27 15:31:49 +07:00
font-style: normal;
}
// Values
u {
2022-10-22 13:11:51 +07:00
color: var(#{$}code-value-color);
2019-11-27 15:31:49 +07:00
text-decoration: none;
}
// Comments
em {
2022-10-22 13:11:51 +07:00
color: var(#{$}code-comment-color);
font-style: normal;
}
2019-11-27 15:31:49 +07:00
}
// kbd
kbd {
2022-10-22 13:11:51 +07:00
background-color: var(#{$}code-kbd-background-color);
color: var(#{$}code-kbd-color);
2021-12-20 10:42:01 -05:00
vertical-align: baseline;
2022-10-15 23:22:12 +07:00
}