webext-base-css
Version:
Extremely minimal stylesheet/setup for Web Extensions’ options pages (also dark mode)
143 lines (125 loc) • 2.48 kB
CSS
/*! https://npm.im/webext-base-css */
:root {
color-scheme: light dark;
max-width: 700px;
margin: auto;
background: var(--background-color);
}
body {
/* Must be on body because both browsers have `font-size: 75%` here */
font: 16px/1.5 system-ui, sans-serif;
}
select,
textarea,
input:where(
[type='number'],
[type='password'],
[type='search'],
[type='text'],
[type='url'],
:not([type])
) {
box-sizing: border-box;
font: inherit;
line-height: 2;
}
textarea,
input:where(
[type='number'],
[type='password'],
[type='search'],
[type='text'],
[type='url'],
:not([type])
):not([size]) {
width: 100%;
}
textarea {
line-height: 1.5; /* Reset it because 2 is too big */
resize: vertical;
min-height: 3lh;
/* stylelint-disable-next-line property-no-unknown */
field-sizing: content;
}
input[type='submit'],
button {
font: inherit;
}
hr {
border: none;
border-bottom: 1px solid currentcolor;
opacity: 50%;
}
img {
vertical-align: middle;
}
kbd {
display: inline-block;
padding: 3px 5px;
font-size: 0.8em;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: 1px solid #d1d5da;
border-radius: 6px;
box-shadow: inset 0 -1px 0 #d1d5da;
}
/* Firefox-only style */
/* stylelint-disable-next-line at-rule-no-vendor-prefix */
@-moz-document url-prefix('') {
@media (prefers-color-scheme: dark) {
:root {
--background-color: #23222b;
}
}
}
/* iOS/iPadOS-specific style */
@supports (-webkit-text-size-adjust: none) {
@media (prefers-color-scheme: dark) {
:root {
/* Safari iOS has a black background */
--background-color: #1e1e1e;
}
}
}
.text-monospace,
.monospace-field {
/* Same as GitHub style for `code` */
font-family:
ui-monospace,
SFMono-Regular,
'SF Mono',
Menlo,
Consolas,
'Liberation Mono',
monospace ;
}
:root.webext-base-css-modal {
background: light-dark(#6e9d9f, #194041);
min-height: 100vh;
display: grid;
place-items: center;
body {
max-width: 500px;
border-radius: 8px;
padding: 8px;
background: var(--background-color, light-dark(#fff, #1e1e1e));
box-shadow:
0.3px 2.8px 2.2px rgb(0 0 0 / 2%),
0.8px 6.7px 5.3px rgb(0 0 0 / 2.8%),
1.5px 12.5px 10px rgb(0 0 0 / 3.5%),
2.7px 22.3px 17.9px rgb(0 0 0 / 4.2%),
5px 41.8px 33.4px rgb(0 0 0 / 5%),
12px 100px 80px rgb(0 0 0 / 7%);
}
body > :first-child {
margin-top: 0;
}
body > :last-child {
margin-bottom: 0;
}
hr {
margin-inline: -8px;
}
}