Change the icon & color of the code block header

This commit is contained in:
Cotes Chung 2021-09-22 21:27:15 +08:00
parent ed93fbdfde
commit abb548fcee
4 changed files with 22 additions and 13 deletions

View file

@ -119,7 +119,7 @@
{% if _left contains 'file="' %} {% if _left contains 'file="' %}
{% assign _text = _left | split: 'file="' | last | split: '"' | first %} {% assign _text = _left | split: 'file="' | last | split: '"' | first %}
{% assign _label_icon = 'far fa-file' %} {% assign _label_icon = 'far fa-file-code' %}
{% else %} {% else %}
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %} {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
{% capture _text %}{% include language-alias.html language=_lang %}{% endcapture %} {% capture _text %}{% include language-alias.html language=_lang %}{% endcapture %}
@ -135,7 +135,7 @@
| append: _label | append: _label
| append: '<button aria-label="copy" data-original-title="' | append: '<button aria-label="copy" data-original-title="'
| append: site.data.locales[lang].post.button.copy_code.succeed | append: site.data.locales[lang].post.button.copy_code.succeed
| append: '"><i class="far fa-clone"></i></button></div>' | append: '"><i class="far fa-clipboard"></i></button></div>'
| append: '<div class="highlight"><code>' | append: '<div class="highlight"><code>'
%} %}

View file

@ -172,17 +172,27 @@ div {
align-items: center; align-items: center;
line-height: 1.85rem; line-height: 1.85rem;
// icons
i {
font-size: 1rem;
color: var(--lang-badge-muted-color);
&.small {
font-size: 70%;
margin-left: 0.25rem;
}
}
// the label block // the label block
span { span {
color: var(--lang-badge-color);
padding-left: 0.6rem; padding-left: 0.6rem;
font-size: 0.85rem;
&:after { &:after {
content: attr(text-data); content: attr(text-data);
margin-left: 0.3rem; margin-left: 0.3rem;
font-size: 0.85rem;
font-weight: 600; font-weight: 600;
color: var(--lang-badge-color);
} }
@at-root [file] #{&} > i { // center the file icon @at-root [file] #{&} > i { // center the file icon
@ -200,13 +210,14 @@ div {
padding: 0; padding: 0;
width: 1.95rem; width: 1.95rem;
background-color: inherit; background-color: inherit;
color: var(--highlight-lineno-color);
@extend %cursor-pointer; @extend %cursor-pointer;
&[timeout] { &[timeout] {
color: var(--clipboard-checked-color);
border-color: var(--clipboard-checked-color); border-color: var(--clipboard-checked-color);
i {
color: var(--clipboard-checked-color);
}
} }
&:not([timeout]):hover { &:not([timeout]):hover {
@ -220,10 +231,6 @@ div {
outline: none; outline: none;
} }
i {
font-size: 0.9rem;
}
} }
} }

View file

@ -75,7 +75,8 @@
--highlight-lineno-color: #6c6c6d; --highlight-lineno-color: #6c6c6d;
--inline-code-bg: #272822; --inline-code-bg: #272822;
--code-header-bg: #353535; --code-header-bg: #353535;
--lang-badge-color: #6c6c6d; --lang-badge-color: #858586;
--lang-badge-muted-color: #6c6c6d;
--clipboard-checked-color: #2bcc2b; --clipboard-checked-color: #2bcc2b;
.highlight { .highlight {

View file

@ -72,7 +72,8 @@
--highlight-lineno-color: #c2c6cc; --highlight-lineno-color: #c2c6cc;
--inline-code-bg: #f3f3f3; --inline-code-bg: #f3f3f3;
--code-header-bg: #eaeaea; --code-header-bg: #eaeaea;
--lang-badge-color: #a4a7ab; --lang-badge-color: rgb(128 128 128 / 87%);
--lang-badge-muted-color: rgb(128 128 128 / 36%);
--clipboard-checked-color: #43c743; --clipboard-checked-color: #43c743;
} // light-syntax } // light-syntax