Files
test-repo/website/playground/playground.css
T
Kendell Randautofix-ci[bot] f591fbe062 Dark mode in the playground (#17705)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-02 08:48:30 +08:00

421 lines
6.8 KiB
CSS

* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html {
background-color: light-dark(#fafafa, #1b1b1d);
color: light-dark(#6a6a6a, #e3e3e3);
--color-border: light-dark(#ddd, #606770);
color-scheme: light dark;
&[data-theme="light"] {
color-scheme: light;
}
&[data-theme="dark"] {
color-scheme: dark;
}
font-family:
-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial,
sans-serif;
font-size: 12px;
line-height: 1.25;
}
body {
display: flex;
flex-direction: column;
height: 100vh;
margin: 0;
}
#root,
.playground-container {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
}
header {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
height: 30px;
padding: 11px 27px;
background-color: #1a2b34;
color: #e0e0e0;
position: relative;
z-index: 20;
}
@media (max-width: 400px) {
header {
padding: 10px;
}
}
header a,
header a:visited,
header a:focus,
header a:active,
header a:hover {
color: #fff;
text-decoration: none;
}
.logo-wrapper {
display: flex;
align-items: center;
}
.logo {
height: 34px;
margin-right: 10px;
}
header h1 {
font-size: 20px;
display: block;
font-family: inherit;
font-weight: 400;
line-height: 18px;
position: relative;
z-index: 9999;
margin: 0;
}
#version {
font-size: 0.5em;
line-height: 0;
opacity: 0.5;
}
.links {
display: flex;
gap: 8px;
font-size: 16px;
align-items: center;
}
.links > * {
display: flex;
}
.theme-icon {
padding-block: 2px;
}
.editors-container {
display: flex;
flex: 1;
min-height: 0;
}
.editors {
display: flex;
flex-flow: row wrap;
flex: 1;
}
.editor {
box-sizing: border-box;
display: flex;
flex: 1 1 100%;
position: relative;
border-bottom: 1px solid var(--color-border);
}
.disabled-output-panel {
flex-direction: column;
align-items: center;
justify-content: center;
gap: 15px;
text-align: center;
}
.disabled-output-panel .explanation {
font-size: 16px;
max-width: 400px;
color: darkred;
}
.disabled-output-panel .btn {
font-size: 22px;
padding: 10px 20px;
}
/* display as 2x2 grid */
@media (min-width: 800px) {
.options-container {
border-right: 0;
}
.editor {
flex-basis: 50%;
border-left: 1px solid var(--color-border);
margin-left: -1px;
}
}
/* display as four columns */
@media (min-width: 1200px) {
.editor {
flex-basis: 25%;
}
}
.editor.loading {
opacity: 0;
}
.CodeMirror {
height: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
line-height: 1.6;
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
&:is([data-theme="dark"] *) {
/* Credit: Chris Kempson, Gerard Braad */
background: #000000;
color: #eaeaea;
div.CodeMirror-selected {
background: #424242;
}
.CodeMirror-gutters {
background: #000000;
border-right: 0px;
}
.CodeMirror-guttermarker {
color: #e78c45;
}
.CodeMirror-guttermarker-subtle {
color: #777;
}
.CodeMirror-linenumber {
color: #424242;
}
.CodeMirror-cursor {
border-left: 1px solid #6a6a6a;
}
span.cm-comment {
color: #d27b53;
}
span.cm-atom {
color: #a16a94;
}
span.cm-number {
color: #a16a94;
}
span.cm-property,
span.cm-attribute {
color: #99cc99;
}
span.cm-keyword {
color: #d54e53;
}
span.cm-string {
color: #e7c547;
}
span.cm-variable {
color: #b9ca4a;
}
span.cm-variable-2 {
color: #7aa6da;
}
span.cm-def {
color: #e78c45;
}
span.cm-bracket {
color: #eaeaea;
}
span.cm-tag {
color: #d54e53;
}
span.cm-link {
color: #a16a94;
}
span.cm-error {
background: #d54e53;
color: #6a6a6a;
}
.CodeMirror-activeline-background {
background: #2a2a2a;
}
.CodeMirror-matchingbracket {
text-decoration: underline;
color: white !important;
}
}
}
.bottom-bar {
position: relative;
}
.bottom-bar-buttons {
z-index: 10;
padding: 8px;
display: flex;
float: left;
}
.bottom-bar-buttons-right {
float: right;
}
.bottom-bar-buttons > * + * {
margin-left: 9px;
}
@media (max-width: 799px) {
.bottom-bar-buttons {
top: auto;
bottom: 100%;
padding: 2px;
}
.bottom-bar-buttons > * + * {
margin-left: 2px;
}
}
.options-container {
display: none;
box-sizing: border-box;
width: 225px;
overflow-y: auto;
border-bottom: 1px solid var(--color-border);
border-right: 1px solid var(--color-border);
flex: 0 1 auto;
}
.options-container.open {
display: block;
}
.options {
display: flex;
flex-direction: column;
max-height: 100%;
overflow: auto;
}
.sub-options {
flex: 1;
padding: 15px 0 10px;
border-bottom: 1px solid var(--color-border);
}
.sub-options:last-child {
border: 0;
}
.sub-options > summary {
font-size: 14px;
font-weight: bold;
padding-bottom: 5px;
cursor: pointer;
}
.sub-options > summary:focus {
outline: 0;
}
.sub-options > * {
margin-left: 10px;
}
label {
font-family:
Consolas,
Courier New,
Courier,
monospace;
margin: 10px 0;
display: block;
}
input[type="number"] {
max-width: 40px;
}
/* Copied from the GitHub button styling. */
.btn {
box-sizing: content-box;
display: inline-block;
height: 18px;
padding: 0 5px;
border-radius: 0.25em;
background-image: linear-gradient(
to bottom,
light-dark(#fafbfc, #090a11),
light-dark(#e4ebf0, #000)
);
color: light-dark(#24292e, #fff);
border: 1px solid var(--color-border);
font-size: 11px;
line-height: 18px;
font-weight: 600;
font-family: inherit;
text-decoration: none;
cursor: pointer;
position: relative;
}
.btn:enabled:is(:hover, :active) {
border-color: light-dark(#afb1b2, #6f7b81);
}
.btn:enabled:hover {
background-color: light-dark(#e6ebf1, #2c3a44);
background-image: linear-gradient(
to bottom,
light-dark(#f0f3f6, #1a2b34),
light-dark(#dce3ec, #090a11)
);
}
.btn:enabled:active {
background-color: light-dark(#e9ecef, #1a2b34);
background-image: none;
box-shadow: inset 0 0.15em 0.3em rgba(27, 31, 35, 0.15);
}
.btn:disabled {
opacity: 0.5;
}
.tooltip {
position: absolute;
z-index: 6;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
margin-top: 4px;
padding: 0.4em 0.8em;
background-color: #000;
color: #fff;
border-radius: 0.4em;
pointer-events: none;
}
.tooltip::before {
content: "";
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 6px solid transparent;
border-bottom: none;
border-top-color: #000;
}