From 21de988cb99a2dad6f8743ab3f3445e5111439b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=A1=93=E6=A1=93?= Date: Tue, 7 Mar 2023 21:18:13 +0800 Subject: [PATCH] feat(colors)!: rewrite color variables logic --- src/_vars.scss | 5 ---- src/partials/code.scss | 2 +- src/partials/figure.scss | 2 +- src/partials/link.scss | 4 +-- src/partials/list.scss | 4 +-- src/partials/quote.scss | 2 +- src/partials/table.scss | 53 ++++++++------------------------- src/variables/_colors.scss | 14 --------- src/variables/modes/_dark.scss | 6 ++++ src/variables/modes/_light.scss | 6 ++++ 10 files changed, 32 insertions(+), 66 deletions(-) delete mode 100644 src/variables/_colors.scss diff --git a/src/_vars.scss b/src/_vars.scss index 724bf9c..22a2d67 100644 --- a/src/_vars.scss +++ b/src/_vars.scss @@ -1,6 +1,5 @@ @use 'sass:meta'; @use 'variables/constants'; -@use 'variables/colors'; @use 'variables/modes/light'; @use 'variables/modes/dark'; @@ -8,10 +7,6 @@ @each $name, $val in meta.module-variables('constants') { --xm-#{$name}: #{$val}; } - - @each $name, $val in meta.module-variables('colors') { - --xm-c-#{$name}: #{$val}; - } } .markdown-body { diff --git a/src/partials/code.scss b/src/partials/code.scss index 4eec508..194aa3f 100644 --- a/src/partials/code.scss +++ b/src/partials/code.scss @@ -15,7 +15,7 @@ pre { margin-bottom: 1.75rem; padding-top: .875rem, 1.15rem; border-radius: .375rem; - color: var(--xm-c-pre); + color: var(--xm-c-deep); font-size: .875rem; line-height: 1.75; code { diff --git a/src/partials/figure.scss b/src/partials/figure.scss index 7d126da..9963237 100644 --- a/src/partials/figure.scss +++ b/src/partials/figure.scss @@ -3,7 +3,7 @@ figure { margin-bottom: 2rem; figcaption { margin-top: .875rem; - color: var(--xm-c-figcaption); + color: var(--xm-c-border-rev); font-size: .875rem; line-height: 1.45; } diff --git a/src/partials/link.scss b/src/partials/link.scss index 7c2d183..96e7856 100644 --- a/src/partials/link.scss +++ b/src/partials/link.scss @@ -1,11 +1,11 @@ a { - border-bottom: 1px solid var(--xm-c-a-border); + border-bottom: 1px solid var(--xm-c-border); color: var(--xm-c-deeper); font-weight: 500; text-decoration: none; transition: border .3s ease-in-out; code { - color: var(--xm-c-code); + color: inherit; } &:hover { border-bottom: 1px solid var(--xm-c-regular); diff --git a/src/partials/list.scss b/src/partials/list.scss index d625365..ad195ee 100644 --- a/src/partials/list.scss +++ b/src/partials/list.scss @@ -14,7 +14,7 @@ ol { content: counter(list-item, decimal) '.'; position: absolute; left: 0; - color: var(--xm-c-ol-counter); + color: var(--xm-c-shallow); font-weight: 400; } } @@ -35,7 +35,7 @@ ul { width: .375rem; height: .375rem; border-radius: 50%; - background-color: var(--xm-c-ul-counter); + background-color: var(--xm-c-shallower); } } } diff --git a/src/partials/quote.scss b/src/partials/quote.scss index f3cc711..e9f971a 100644 --- a/src/partials/quote.scss +++ b/src/partials/quote.scss @@ -3,7 +3,7 @@ q { margin-top: 1.65rem; margin-bottom: 1.65rem; padding: .6rem 1.2rem; - border-left: .25rem solid var(--xm-c-quote-border); + border-left: .25rem solid var(--xm-c-border); color: inherit; font-weight: 500; font-style: italic; diff --git a/src/partials/table.scss b/src/partials/table.scss index 6b6c39d..9054f5d 100644 --- a/src/partials/table.scss +++ b/src/partials/table.scss @@ -1,46 +1,19 @@ table { width: 100%; - margin-top: 2rem; - margin-bottom: 2rem; - table-layout: auto; - font-size: .875rem; - line-height: 1.75; - text-align: left; -} - -thead { - border-bottom-width: 1px; - border-bottom-color: var(--xm-c-thead-border); - color: var(--xm-c-thead); - font-weight: 600; - th { - vertical-align: bottom; - padding-left: auto .575rem .575rem; - &:first-child { - padding-left: 0; - } - &:last-child { - padding-right: 0; - } - } -} - -tbody { - tr { - border-bottom-width: 1px; - border-bottom-color: var(--xm-c-tr-border); - &:last-child { - border-bottom-width: 0; - } - } + overflow: auto; + border-spacing: 0; + border-collapse: collapse; + th, td { - vertical-align: top; - padding: .575rem; - &:first-child { - padding-left: 0; - } - &:last-child { - padding-right: 0; + padding: 6px 13px; + border: 1.5px solid var(--xm-c-border-rev); + } + thead > tr > th { + font-weight: 700; + } + tbody > tr { + &:hover { + background-color: var(--xm-c-shallowest); } } } diff --git a/src/variables/_colors.scss b/src/variables/_colors.scss deleted file mode 100644 index e06e424..0000000 --- a/src/variables/_colors.scss +++ /dev/null @@ -1,14 +0,0 @@ -// Colors -$pre: #e5e7eb; -$code: #111827; -$figcaption: #6b7280; -$thead: #111827; -$ol-counter: #6b7280; -$ul-counter: #d1d5db; - -// Border -$a-border: hsla(0deg 0% 50% / .3); -$hr-border: hsla(0deg 0% 50% / .3); -$quote-border: hsla(0deg 0% 50% / .3); -$thead-border: #d1d5db; -$tr-border: #e5e7eb; diff --git a/src/variables/modes/_dark.scss b/src/variables/modes/_dark.scss index 26d551e..60920ab 100644 --- a/src/variables/modes/_dark.scss +++ b/src/variables/modes/_dark.scss @@ -1,3 +1,9 @@ +$shallowest: #212121; +$shallower: #555; +$shallow: #777; $regular: #bbb; $deep: #ddd; $deeper: #fff; + +$border: hsla(0deg 0 75% / .3); +$border-rev: hsla(0deg 0 40% / .75); diff --git a/src/variables/modes/_light.scss b/src/variables/modes/_light.scss index 88d8e5d..5dc9588 100644 --- a/src/variables/modes/_light.scss +++ b/src/variables/modes/_light.scss @@ -1,3 +1,9 @@ +$shallowest: #f0f0f0; +$shallower: #ddd; +$shallow: #bbb; $regular: #555; $deep: #222; $deeper: #000; + +$border: hsla(0deg 0 25% / .3); +$border-rev: hsla(0deg 0 50% / .5);