From 3be772677564458f16cceb70caa707de7b9094d6 Mon Sep 17 00:00:00 2001 From: daudix Date: Wed, 7 Aug 2024 04:16:15 +0300 Subject: [PATCH] Style color input, add color picker to the demo --- content/demo/index.md | 76 +++++++++++++++++++++++++++++++++++++++++++ sass/_input.scss | 31 +++++++++++++++++- 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/content/demo/index.md b/content/demo/index.md index 1db8a00..121e620 100644 --- a/content/demo/index.md +++ b/content/demo/index.md @@ -11,6 +11,82 @@ This is a demo of most of the components, but some of them are only accessible o - [Post Demo](@/blog/the-quill-of-duck/index.md) {% end %} + +
+ + +
+ + + + + + ## Markdown Text can be **bold**, *italic*, ~~strikethrough~~, and ***~~all at the same time~~***. diff --git a/sass/_input.scss b/sass/_input.scss index a688264..115c8b8 100644 --- a/sass/_input.scss +++ b/sass/_input.scss @@ -1,5 +1,6 @@ input[type="radio"], -input[type="checkbox"] { +input[type="checkbox"], +input[type="color"] { -webkit-appearance: none; position: relative; appearance: none; @@ -52,6 +53,7 @@ input[type="checkbox"] { } input[type="radio"] { + vertical-align: -0.1875em; border-radius: 50%; &::before { @@ -64,6 +66,7 @@ input[type="radio"] { } input[type="checkbox"] { + vertical-align: -0.1875em; border-radius: calc(var(--rounded-corner-small) / 2); &::before { @@ -80,3 +83,29 @@ input[type="checkbox"] { content: ""; } } + +input[type="color"] { + vertical-align: -0.375em; + border: 0.25rem solid var(--fg-muted-2); + border-radius: var(--rounded-corner-small); + padding: 0; + width: 3rem; + height: 2rem; + + &:hover { + background-color: var(--fg-muted-2); + } + + &::-moz-color-swatch { + border: none; + border-radius: calc(var(--rounded-corner-small) / 2); + } + + &::-webkit-color-swatch-wrapper { + padding: 0; + } + + &::-webkit-color-swatch { + border-radius: calc(var(--rounded-corner-small) / 2); + } +}