@ckeditor/ckeditor5-theme-lark
Version:
A bright theme for CKEditor 5.
135 lines (112 loc) • 4 kB
CSS
/*
* Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
@import "../../../mixins/_rounded.css";
@import "../../../mixins/_disabled.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";
/* Note: To avoid rendering issues (aliasing) but to preserve the responsive nature
of the component, floating–point numbers have been used which, for the default font size
(see: --ck-font-size-base), will generate simple integers. */
:root {
/* 34px at 13px font-size */
--ck-switch-button-toggle-width: 2.6153846154em;
/* 14px at 13px font-size */
--ck-switch-button-toggle-inner-size: calc(1.0769230769em + 1px);
--ck-switch-button-translation: calc(
var(--ck-switch-button-toggle-width) -
var(--ck-switch-button-toggle-inner-size) -
2px /* Border */
);
--ck-switch-button-inner-hover-shadow: 0 0 0 5px var(--ck-color-switch-button-inner-shadow);
}
.ck.ck-button.ck-switchbutton {
/* Unlike a regular button, the switch button text color and background should never change.
* Changing toggle switch (background, outline) is enough to carry the information about the
* state of the entire component (https://github.com/ckeditor/ckeditor5/issues/12519)
*/
&, &:hover, &:focus, &:active, &.ck-on:hover, &.ck-on:focus, &.ck-on:active {
color: inherit;
background: transparent;
}
& .ck-button__label {
@mixin ck-dir ltr {
/* Separate the label from the switch */
margin-right: calc(2 * var(--ck-spacing-large));
}
@mixin ck-dir rtl {
/* Separate the label from the switch */
margin-left: calc(2 * var(--ck-spacing-large));
}
}
& .ck-button__toggle {
@mixin ck-rounded-corners;
@mixin ck-dir ltr {
/* Make sure the toggle is always to the right as far as possible. */
margin-left: auto;
}
@mixin ck-dir rtl {
/* Make sure the toggle is always to the left as far as possible. */
margin-right: auto;
}
/* Apply some smooth transition to the box-shadow and border. */
/* Gently animate the background color of the toggle switch */
transition: background 400ms ease, box-shadow .2s ease-in-out, outline .2s ease-in-out;
border: 1px solid transparent;
width: var(--ck-switch-button-toggle-width);
background: var(--ck-color-switch-button-off-background);
& .ck-button__toggle__inner {
@mixin ck-rounded-corners {
border-radius: calc(.5 * var(--ck-border-radius));
}
width: var(--ck-switch-button-toggle-inner-size);
height: var(--ck-switch-button-toggle-inner-size);
background: var(--ck-color-switch-button-inner-background);
/* Gently animate the inner part of the toggle switch */
transition: all 300ms ease;
@media (prefers-reduced-motion: reduce) {
transition: none;
}
}
&:hover {
background: var(--ck-color-switch-button-off-hover-background);
& .ck-button__toggle__inner {
box-shadow: var(--ck-switch-button-inner-hover-shadow);
}
}
}
&.ck-disabled .ck-button__toggle {
@mixin ck-disabled;
}
/* Overriding default .ck-button:focus styles + an outline around the toogle */
&:focus {
border-color: transparent;
outline: none;
box-shadow: none;
& .ck-button__toggle {
box-shadow: 0 0 0 1px var(--ck-color-base-background), 0 0 0 5px var(--ck-color-focus-outer-shadow);
outline-offset: 1px;
outline: var(--ck-focus-ring);
}
}
/* stylelint-disable-next-line no-descending-specificity */
&.ck-on {
& .ck-button__toggle {
background: var(--ck-color-switch-button-on-background);
&:hover {
background: var(--ck-color-switch-button-on-hover-background);
}
& .ck-button__toggle__inner {
/*
* Move the toggle switch to the right. It will be animated.
*/
@mixin ck-dir ltr {
transform: translateX( var( --ck-switch-button-translation ) );
}
@mixin ck-dir rtl {
transform: translateX( calc( -1 * var( --ck-switch-button-translation ) ) );
}
}
}
}
}