dark theme fixes

This commit is contained in:
Kirill Zhumarin 2024-06-05 11:44:58 +00:00
parent 9c80e7ab6a
commit d88975710b
7 changed files with 436 additions and 31 deletions

View file

@ -8,7 +8,6 @@
<title>Siemens Dev Tools</title>
<script>
/*
(function () {
let media = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
let themeChange = () => {
@ -19,7 +18,6 @@
themeChange();
}
})();
*/
</script>
</head>
<body>

175
src/bootstrap.scss vendored Normal file
View file

@ -0,0 +1,175 @@
// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
@import "../node_modules/bootstrap/scss/functions";
// 2. Include any default variable overrides here
$info: #0aa7c7;
// 3. Include remainder of required Bootstrap stylesheets (including any separate color mode stylesheets)
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/variables-dark";
// 4. Include any default map overrides here
// 5. Include remainder of required parts
@import "../node_modules/bootstrap/scss/maps";
@import "../node_modules/bootstrap/scss/mixins";
@import "../node_modules/bootstrap/scss/utilities";
// 6. Optionally include any other parts as needed
@import "../node_modules/bootstrap/scss/root";
@import "../node_modules/bootstrap/scss/reboot";
@import "../node_modules/bootstrap/scss/type";
@import "../node_modules/bootstrap/scss/images";
@import "../node_modules/bootstrap/scss/containers";
@import "../node_modules/bootstrap/scss/grid";
@import "../node_modules/bootstrap/scss/tables";
@import "../node_modules/bootstrap/scss/forms";
@import "../node_modules/bootstrap/scss/buttons";
@import "../node_modules/bootstrap/scss/transitions";
@import "../node_modules/bootstrap/scss/dropdown";
@import "../node_modules/bootstrap/scss/button-group";
@import "../node_modules/bootstrap/scss/nav";
@import "../node_modules/bootstrap/scss/navbar";
@import "../node_modules/bootstrap/scss/card";
@import "../node_modules/bootstrap/scss/accordion";
@import "../node_modules/bootstrap/scss/breadcrumb";
@import "../node_modules/bootstrap/scss/pagination";
@import "../node_modules/bootstrap/scss/badge";
@import "../node_modules/bootstrap/scss/alert";
@import "../node_modules/bootstrap/scss/progress";
@import "../node_modules/bootstrap/scss/list-group";
@import "../node_modules/bootstrap/scss/close";
@import "../node_modules/bootstrap/scss/toasts";
@import "../node_modules/bootstrap/scss/modal";
@import "../node_modules/bootstrap/scss/tooltip";
@import "../node_modules/bootstrap/scss/popover";
@import "../node_modules/bootstrap/scss/carousel";
@import "../node_modules/bootstrap/scss/spinners";
@import "../node_modules/bootstrap/scss/offcanvas";
@import "../node_modules/bootstrap/scss/placeholders";
@import "../node_modules/bootstrap/scss/helpers";
// 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`
@import "../node_modules/bootstrap/scss/utilities/api";
// 8. Add additional custom code here
body {
overflow-y: scroll;
}
.table-sticky-header {
thead {
position: sticky;
top: -1px;
}
thead {
box-shadow: 0px 1px 0px var(--bs-table-border-color);
}
th {
background-color: var(--bs-tertiary-bg);
}
}
.table-sort-btn {
cursor: pointer;
user-select: none;
}
/* Dark theme fixes */
@include color-mode(dark) {
/* Fix text colors */
--bs-info-rgb: 8, 135, 160;
--bs-danger-rgb: 224, 82, 96;
--bs-primary-rgb: 109, 167, 254;
--bs-info-rgb: 11, 171, 203;
--bs-success-rgb: 32, 172, 107;
/* Fix table rows */
.table-danger {
--bs-table-color: var(--bs-body-color);
--bs-table-bg: var(--bs-danger-bg-subtle);
--bs-table-border-color: var(--bs-danger-border-subtle);
--bs-table-striped-bg: #25090b;
--bs-table-striped-color: var(--bs-body-color);
--bs-table-active-bg: #411014;
--bs-table-active-color: var(--bs-body-color);
--bs-table-hover-bg: #411014;
--bs-table-hover-color: var(--bs-body-color);
color: var(--bs-table-color);
border-color: rgba(255, 255, 255, 0.2);
}
.table-warning {
--bs-table-color: var(--bs-body-color);
--bs-table-bg: var(--bs-warning-bg-subtle);
--bs-table-border-color: var(--bs-warning-border-subtle);
--bs-table-striped-bg: #2d2301;
--bs-table-striped-color: var(--bs-body-color);
--bs-table-active-bg: #413201;
--bs-table-active-color: var(--bs-body-color);
--bs-table-hover-bg: #413201;
--bs-table-hover-color: var(--bs-body-color);
color: var(--bs-table-color);
border-color: rgba(255, 255, 255, 0.2);
}
.table-info {
--bs-table-color: var(--bs-body-color);
--bs-table-bg: var(--bs-info-bg-subtle);
--bs-table-border-color: var(--bs-info-border-subtle);
--bs-table-striped-bg: #03242b;
--bs-table-striped-color: var(--bs-body-color);
--bs-table-active-bg: #05343e;
--bs-table-active-color: var(--bs-body-color);
--bs-table-hover-bg: #05343e;
--bs-table-hover-color: var(--bs-body-color);
color: var(--bs-table-color);
border-color: rgba(255, 255, 255, 0.2);
}
/* Fix outline buttons */
.btn-outline-primary {
--bs-btn-color: rgb(var(--bs-primary-rgb));
--bs-btn-border-color: rgb(var(--bs-primary-rgb));
}
.btn-outline-secondary {
--bs-btn-color: rgb(var(--bs-secondary-rgb));
--bs-btn-border-color: rgb(var(--bs-secondary-rgb));
}
.btn-outline-success {
--bs-btn-color: rgb(var(--bs-success-rgb));
--bs-btn-border-color: rgb(var(--bs-success-rgb));
}
.btn-outline-info {
--bs-btn-color: rgb(var(--bs-info-rgb));
--bs-btn-border-color: rgb(var(--bs-info-rgb));
}
.btn-outline-danger {
--bs-btn-color: rgb(var(--bs-danger-rgb));
--bs-btn-border-color: rgb(var(--bs-danger-rgb));
}
.btn-outline-warning {
--bs-btn-color: rgb(var(--bs-warning-rgb));
--bs-btn-border-color: rgb(var(--bs-warning-rgb));
}
/* Fix bg colors */
.bg-success {
--bs-success-rgb: 23, 125, 77;
}
.bg-info {
--bs-info-rgb: 8, 131, 150;
}
.bg-danger {
--bs-danger-rgb: 157, 67, 76;
}
}

View file

@ -1,6 +1,6 @@
import hljs from 'highlight.js/lib/core';
import hljsLangC from 'highlight.js/lib/languages/c';
import 'highlight.js/styles/github.css';
import './hljs.scss';
hljs.registerLanguage('c', hljsLangC);

258
src/hljs.scss Normal file
View file

@ -0,0 +1,258 @@
$color-mode-type: data;
@import "../node_modules/bootstrap/scss/mixins";
@include color-mode(dark) {
/*!
* Theme: GitHub Dark
* Description: Dark theme as seen on github.com
* Author: github.com
* Maintainer: @Hirse
* Updated: 2021-05-15
*
* Outdated base version: https://github.com/primer/github-syntax-dark
* Current colors taken from GitHub's CSS
*/
.hljs {
color: #c9d1d9;
background: #0d1117;
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #ff7b72;
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #d2a8ff;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #79c0ff;
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #a5d6ff;
}
.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #ffa657;
}
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #8b949e;
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #7ee787;
}
.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #c9d1d9;
}
.hljs-section {
/* prettylights-syntax-markup-heading */
color: #1f6feb;
font-weight: bold;
}
.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #f2cc60;
}
.hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #c9d1d9;
font-style: italic;
}
.hljs-strong {
/* prettylights-syntax-markup-bold */
color: #c9d1d9;
font-weight: bold;
}
.hljs-addition {
/* prettylights-syntax-markup-inserted */
color: #aff5b4;
background-color: #033a16;
}
.hljs-deletion {
/* prettylights-syntax-markup-deleted */
color: #ffdcd7;
background-color: #67060c;
}
.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
/* purposely ignored */
}
}
@include color-mode(light) {
/*!
* Theme: GitHub
* Description: Light theme as seen on github.com
* Author: github.com
* Maintainer: @Hirse
* Updated: 2021-05-15
*
* Outdated base version: https://github.com/primer/github-syntax-light
* Current colors taken from GitHub's CSS
*/
.hljs {
color: #24292e;
background: #ffffff;
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #d73a49;
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #6f42c1;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #005cc5;
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #032f62;
}
.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #e36209;
}
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #6a737d;
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #22863a;
}
.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #24292e;
}
.hljs-section {
/* prettylights-syntax-markup-heading */
color: #005cc5;
font-weight: bold;
}
.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #735c0f;
}
.hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #24292e;
font-style: italic;
}
.hljs-strong {
/* prettylights-syntax-markup-bold */
color: #24292e;
font-weight: bold;
}
.hljs-addition {
/* prettylights-syntax-markup-inserted */
color: #22863a;
background-color: #f0fff4;
}
.hljs-deletion {
/* prettylights-syntax-markup-deleted */
color: #b31d28;
background-color: #ffeef0;
}
.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
/* purposely ignored */
}
}

View file

@ -4,9 +4,8 @@ import { render } from 'solid-js/web';
import { Router, Route, Navigate } from "@solidjs/router";
import App from './pages/App';
import 'bootstrap/dist/css/bootstrap.min.css';
import "./bootstrap.scss";
import "bootstrap-icons/font/bootstrap-icons.css";
import './index.scss';
const Swilib = lazy(() => import("./pages/Swilib"));
const SwilibPhone = lazy(() => import("./pages/SwilibPhone"));

View file

@ -1,23 +0,0 @@
body {
overflow-y: scroll;
}
.table-sticky-header {
thead {
position: sticky;
top: -1px;
}
thead {
box-shadow: 0px 1px 0px var(--bs-table-border-color);
}
th {
background-color: var(--bs-tertiary-bg);
}
}
.table-sort-btn {
cursor: pointer;
user-select: none;
}

View file

@ -96,9 +96,7 @@ function SwilibTableRow(props) {
{props.swilib[props.entry.id].value.toString(16).padStart(8, '0').toUpperCase()}
</Show>
</td>
<td classList={{ 'text-muted': props.entry.name == null }}>
<SwilibCoverageValue value={props.entry.ptrCoverage[platformToIndex(props.platform)]} platform={props.platform} />
</td>
<SwilibCoverageValue value={props.entry.ptrCoverage[platformToIndex(props.platform)]} platform={props.platform} />
</tr>
</>
);