Skip to content

Commit 093a702

Browse files
authored
Add webext-base-css-modal class (#21)
1 parent 49bd32c commit 093a702

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

options.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<meta charset="utf-8">
44
<title>Demo</title>
55
<link rel="stylesheet" href="webext-base.css">
6+
<script src="options.js"></script>
67
</head>
78

89
<h1>Heading 🤝</h1>

options.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
document.addEventListener('dblclick', function() {
2+
document.documentElement.classList.toggle('webext-base-css-modal');
3+
});

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ Here's a minimal but full `options.html` example page:
9494
There are some extra classes you can use:
9595

9696
- `.text-monospace` ideal for for `<input>` and `<textarea>` to have a monospace font
97+
- `webext-base-css-modal` can be applied to HTML if you have a small options page but don't want to use `options_ui`. See the [what it looks like.](https://github.com/fregante/webext-base-css/pull/21)
98+
9799

98100
## Tips
99101

webext-base.css

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
color-scheme: light dark;
55
max-width: 700px;
66
margin: auto;
7+
background: var(--background-color);
78
}
89

910
body {
@@ -78,7 +79,7 @@ kbd {
7879
@-moz-document url-prefix('') {
7980
@media (prefers-color-scheme: dark) {
8081
:root {
81-
background-color: #23222b;
82+
--background-color: #23222b;
8283
}
8384
}
8485
}
@@ -88,7 +89,7 @@ kbd {
8889
@media (prefers-color-scheme: dark) {
8990
:root {
9091
/* Safari iOS has a black background */
91-
background-color: #1e1e1e;
92+
--background-color: #1e1e1e;
9293
}
9394
}
9495
}
@@ -105,3 +106,36 @@ kbd {
105106
'Liberation Mono',
106107
monospace !important;
107108
}
109+
110+
:root.webext-base-css-modal {
111+
background: light-dark(#6e9d9f, #194041);
112+
min-height: 100vh;
113+
display: grid;
114+
place-items: center;
115+
116+
body {
117+
max-width: 500px;
118+
border-radius: 8px;
119+
padding: 8px;
120+
background: var(--background-color, light-dark(#fff, #1e1e1e));
121+
box-shadow:
122+
0.3px 2.8px 2.2px rgb(0 0 0 / 2%),
123+
0.8px 6.7px 5.3px rgb(0 0 0 / 2.8%),
124+
1.5px 12.5px 10px rgb(0 0 0 / 3.5%),
125+
2.7px 22.3px 17.9px rgb(0 0 0 / 4.2%),
126+
5px 41.8px 33.4px rgb(0 0 0 / 5%),
127+
12px 100px 80px rgb(0 0 0 / 7%);
128+
}
129+
130+
body > :first-child {
131+
margin-top: 0;
132+
}
133+
134+
body > :last-child {
135+
margin-bottom: 0;
136+
}
137+
138+
hr {
139+
margin-inline: -8px;
140+
}
141+
}

0 commit comments

Comments
 (0)