{children}
diff --git a/packages/excalidraw/components/CheckboxItem.scss b/packages/excalidraw/components/CheckboxItem.scss
index 6aaf0aab69..3ad775f227 100644
--- a/packages/excalidraw/components/CheckboxItem.scss
+++ b/packages/excalidraw/components/CheckboxItem.scss
@@ -1,4 +1,5 @@
-@import "../css/variables.module.scss";
+@use "sass:color";
+@use "../css/variables.module" as *;
.excalidraw {
.Checkbox {
@@ -12,7 +13,7 @@
-webkit-tap-highlight-color: transparent;
&:hover:not(.is-checked) .Checkbox-box:not(:focus) {
- box-shadow: 0 0 0 2px #{$oc-blue-4};
+ box-shadow: 0 0 0 2px #{$color-blue-4};
}
&:hover:not(.is-checked) .Checkbox-box:not(:focus) {
@@ -24,25 +25,25 @@
&:active {
.Checkbox-box {
- box-shadow: 0 0 2px 1px inset #{$oc-blue-7} !important;
+ box-shadow: 0 0 2px 1px inset #{$color-blue-7} !important;
}
}
&:hover {
.Checkbox-box {
- background-color: fade-out($oc-blue-1, 0.8);
+ background-color: color.adjust($color-blue-1, $alpha: -0.8);
}
}
&.is-checked {
.Checkbox-box {
- background-color: #{$oc-blue-1};
+ background-color: #{$color-blue-1};
svg {
display: block;
}
}
&:hover .Checkbox-box {
- background-color: #{$oc-blue-2};
+ background-color: #{$color-blue-2};
}
}
@@ -58,16 +59,16 @@
align-items: center;
justify-content: center;
- box-shadow: 0 0 0 2px #{$oc-blue-7};
+ box-shadow: 0 0 0 2px #{$color-blue-7};
background-color: transparent;
border-radius: 4px;
- color: #{$oc-blue-7};
+ color: #{$color-blue-7};
border: 0;
&:focus {
- box-shadow: 0 0 0 3px #{$oc-blue-7};
+ box-shadow: 0 0 0 3px #{$color-blue-7};
}
svg {
diff --git a/packages/excalidraw/components/ColorPicker/ColorInput.tsx b/packages/excalidraw/components/ColorPicker/ColorInput.tsx
index b433b48578..97704ffc09 100644
--- a/packages/excalidraw/components/ColorPicker/ColorInput.tsx
+++ b/packages/excalidraw/components/ColorPicker/ColorInput.tsx
@@ -1,9 +1,7 @@
import clsx from "clsx";
import { useCallback, useEffect, useRef, useState } from "react";
-import { isTransparent, KEYS } from "@excalidraw/common";
-
-import tinycolor from "tinycolor2";
+import { KEYS, normalizeInputColor } from "@excalidraw/common";
import { getShortcutKey } from "../..//shortcut";
import { useAtom } from "../../editor-jotai";
@@ -16,29 +14,6 @@ import { activeColorPickerSectionAtom } from "./colorPickerUtils";
import type { ColorPickerType } from "./colorPickerUtils";
-/**
- * tries to keep the input color as-is if it's valid, making minimal adjustments
- * (trimming whitespace or adding `#` to hex colors)
- */
-export const normalizeInputColor = (color: string): string | null => {
- color = color.trim();
- if (isTransparent(color)) {
- return color;
- }
-
- const tc = tinycolor(color);
- if (tc.isValid()) {
- // testing for `#` first fixes a bug on Electron (more specfically, an
- // Obsidian popout window), where a hex color without `#` is considered valid
- if (tc.getFormat() === "hex" && !color.startsWith("#")) {
- return `#${color}`;
- }
- return color;
- }
-
- return null;
-};
-
export const ColorInput = ({
color,
onChange,
diff --git a/packages/excalidraw/components/ColorPicker/ColorPicker.scss b/packages/excalidraw/components/ColorPicker/ColorPicker.scss
index 658a75dad7..e1bacfca9a 100644
--- a/packages/excalidraw/components/ColorPicker/ColorPicker.scss
+++ b/packages/excalidraw/components/ColorPicker/ColorPicker.scss
@@ -1,4 +1,5 @@
-@import "../../css/variables.module.scss";
+@use "sass:color";
+@use "../../css/variables.module" as *;
.excalidraw {
.focus-visible-none {
@@ -185,8 +186,8 @@
.color-picker {
background: var(--popup-bg-color);
- border: 0 solid transparentize($oc-white, 0.75);
- box-shadow: transparentize($oc-black, 0.75) 0 1px 4px;
+ border: 0 solid color.adjust(#fff, $alpha: -0.75);
+ box-shadow: color.adjust(#000, $alpha: -0.75) 0 1px 4px;
border-radius: 4px;
position: absolute;
@@ -243,7 +244,7 @@
}
.color-picker-triangle-shadow {
- border-color: transparent transparent transparentize($oc-black, 0.9);
+ border-color: transparent transparent color.adjust(#000, $alpha: -0.9);
:root[dir="ltr"] & {
left: -14px;
@@ -280,7 +281,7 @@
padding: 0.25rem;
&-title {
- color: $oc-gray-6;
+ color: $color-gray-6;
font-size: 12px;
padding: 0 0.25rem;
}
@@ -319,7 +320,7 @@
.color-picker-transparent {
border-radius: 4px;
- box-shadow: transparentize($oc-black, 0.9) 0 0 0 1px inset;
+ box-shadow: color.adjust(#000, $alpha: -0.9) 0 0 0 1px inset;
position: absolute;
top: 0;
right: 0;
@@ -473,7 +474,7 @@
}
.color-picker-type-elementBackground .color-picker-keybinding {
- color: $oc-white;
+ color: #fff;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
@@ -486,10 +487,10 @@
&.theme--dark {
.color-picker-type-elementBackground .color-picker-keybinding {
- color: $oc-black;
+ color: #000;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
- color: $oc-black;
+ color: #000;
}
}
}
diff --git a/packages/excalidraw/components/ColorPicker/ColorPicker.tsx b/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
index ffbffce962..5de89f7590 100644
--- a/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
+++ b/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
@@ -5,6 +5,7 @@ import { useRef, useEffect } from "react";
import {
COLOR_OUTLINE_CONTRAST_THRESHOLD,
COLOR_PALETTE,
+ isColorDark,
isWritableElement,
} from "@excalidraw/common";
@@ -29,7 +30,7 @@ import { ColorInput } from "./ColorInput";
import { Picker } from "./Picker";
import PickerHeading from "./PickerHeading";
import { TopPicks } from "./TopPicks";
-import { activeColorPickerSectionAtom, isColorDark } from "./colorPickerUtils";
+import { activeColorPickerSectionAtom } from "./colorPickerUtils";
import "./ColorPicker.scss";
diff --git a/packages/excalidraw/components/ColorPicker/HotkeyLabel.tsx b/packages/excalidraw/components/ColorPicker/HotkeyLabel.tsx
index 898a289703..d164c4119f 100644
--- a/packages/excalidraw/components/ColorPicker/HotkeyLabel.tsx
+++ b/packages/excalidraw/components/ColorPicker/HotkeyLabel.tsx
@@ -1,6 +1,5 @@
import React from "react";
-
-import { isColorDark } from "./colorPickerUtils";
+import { isColorDark } from "@excalidraw/common";
interface HotkeyLabelProps {
color: string;
diff --git a/packages/excalidraw/components/ColorPicker/TopPicks.tsx b/packages/excalidraw/components/ColorPicker/TopPicks.tsx
index 6a00b18178..5b5070a5b6 100644
--- a/packages/excalidraw/components/ColorPicker/TopPicks.tsx
+++ b/packages/excalidraw/components/ColorPicker/TopPicks.tsx
@@ -5,10 +5,9 @@ import {
DEFAULT_CANVAS_BACKGROUND_PICKS,
DEFAULT_ELEMENT_BACKGROUND_PICKS,
DEFAULT_ELEMENT_STROKE_PICKS,
+ isColorDark,
} from "@excalidraw/common";
-import { isColorDark } from "./colorPickerUtils";
-
import type { ColorPickerType } from "./colorPickerUtils";
interface TopPicksProps {
diff --git a/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts b/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
index 3bf86d85a3..fee8f8cfc2 100644
--- a/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
+++ b/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
@@ -1,8 +1,4 @@
-import {
- isTransparent,
- MAX_CUSTOM_COLORS_USED_IN_CANVAS,
- tinycolor,
-} from "@excalidraw/common";
+import { MAX_CUSTOM_COLORS_USED_IN_CANVAS } from "@excalidraw/common";
import type { ExcalidrawElement } from "@excalidraw/element/types";
@@ -100,32 +96,6 @@ export type ActiveColorPickerSectionAtomType =
export const activeColorPickerSectionAtom =
atom
(null);
-const calculateContrast = (r: number, g: number, b: number): number => {
- const yiq = (r * 299 + g * 587 + b * 114) / 1000;
- return yiq;
-};
-
-// YIQ algo, inspiration from https://stackoverflow.com/a/11868398
-export const isColorDark = (color: string, threshold = 160): boolean => {
- // no color ("") -> assume it default to black
- if (!color) {
- return true;
- }
-
- if (isTransparent(color)) {
- return false;
- }
-
- const tc = tinycolor(color);
- if (!tc.isValid()) {
- // invalid color -> assume it defaults to black
- return true;
- }
-
- const { r, g, b } = tc.toRgb();
- return calculateContrast(r, g, b) < threshold;
-};
-
export type ColorPickerType =
| "canvasBackground"
| "elementBackground"
diff --git a/packages/excalidraw/components/CommandPalette/CommandPalette.scss b/packages/excalidraw/components/CommandPalette/CommandPalette.scss
index 0a02c23b04..3706244877 100644
--- a/packages/excalidraw/components/CommandPalette/CommandPalette.scss
+++ b/packages/excalidraw/components/CommandPalette/CommandPalette.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
$verticalBreakpoint: 861px;
diff --git a/packages/excalidraw/components/ConfirmDialog.scss b/packages/excalidraw/components/ConfirmDialog.scss
index 1fa36fc41d..7dfd956adb 100644
--- a/packages/excalidraw/components/ConfirmDialog.scss
+++ b/packages/excalidraw/components/ConfirmDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.confirm-dialog {
diff --git a/packages/excalidraw/components/ContextMenu.scss b/packages/excalidraw/components/ContextMenu.scss
index 0b370d919b..369d8f3d8e 100644
--- a/packages/excalidraw/components/ContextMenu.scss
+++ b/packages/excalidraw/components/ContextMenu.scss
@@ -1,4 +1,5 @@
-@import "../css/variables.module.scss";
+@use "sass:color";
+@use "../css/variables.module" as *;
.excalidraw {
.context-menu-popover {
@@ -8,7 +9,7 @@
.context-menu {
position: relative;
border-radius: 4px;
- box-shadow: 0 3px 10px transparentize($oc-black, 0.8);
+ box-shadow: 0 3px 10px color.adjust(#000, $alpha: -0.8);
padding: 0;
list-style: none;
user-select: none;
@@ -49,7 +50,7 @@
&.dangerous {
.context-menu-item__label {
- color: $oc-red-7;
+ color: $color-red-7;
}
}
@@ -73,7 +74,7 @@
.context-menu-item__label {
color: var(--popup-bg-color);
}
- background-color: $oc-red-6;
+ background-color: $color-red-6;
}
}
@@ -97,6 +98,6 @@
.context-menu-item-separator {
border: none;
- border-top: 1px solid $oc-gray-5;
+ border-top: 1px solid $color-gray-5;
}
}
diff --git a/packages/excalidraw/components/ConvertElementTypePopup.scss b/packages/excalidraw/components/ConvertElementTypePopup.scss
index 414ca9533b..d334c7d368 100644
--- a/packages/excalidraw/components/ConvertElementTypePopup.scss
+++ b/packages/excalidraw/components/ConvertElementTypePopup.scss
@@ -1,4 +1,4 @@
-@import "../css//variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.ConvertElementTypePopup {
diff --git a/packages/excalidraw/components/Dialog.scss b/packages/excalidraw/components/Dialog.scss
index 622d304044..4a105077bc 100644
--- a/packages/excalidraw/components/Dialog.scss
+++ b/packages/excalidraw/components/Dialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.Dialog {
diff --git a/packages/excalidraw/components/ElementLinkDialog.scss b/packages/excalidraw/components/ElementLinkDialog.scss
index 9923230741..ab501c204d 100644
--- a/packages/excalidraw/components/ElementLinkDialog.scss
+++ b/packages/excalidraw/components/ElementLinkDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.ElementLinkDialog {
@@ -59,7 +59,7 @@
}
.ElementLinkDialog__remove {
- color: $oc-red-9;
+ color: $color-red-9;
margin-left: 1rem;
.ToolIcon__icon {
@@ -68,7 +68,7 @@
}
.ToolIcon__icon svg {
- color: $oc-red-6;
+ color: $color-red-6;
}
}
}
diff --git a/packages/excalidraw/components/ExportDialog.scss b/packages/excalidraw/components/ExportDialog.scss
index d114f25be6..ed3ca6f605 100644
--- a/packages/excalidraw/components/ExportDialog.scss
+++ b/packages/excalidraw/components/ExportDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.ExportDialog__preview {
@@ -112,7 +112,7 @@
font-family: Cascadia;
font-size: 1.8em;
- color: $oc-white;
+ color: #fff;
&:hover {
background-color: var(--button-color-darker);
diff --git a/packages/excalidraw/components/FilledButton.scss b/packages/excalidraw/components/FilledButton.scss
index 1f689e9697..44f24f3b0f 100644
--- a/packages/excalidraw/components/FilledButton.scss
+++ b/packages/excalidraw/components/FilledButton.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
@keyframes successStatusAnimation {
0% {
@@ -24,6 +24,14 @@
background-color: var(--back-color);
border-color: var(--border-color);
+ border-radius: 0.5rem;
+ border-width: 1px;
+ border-style: solid;
+
+ font-family: var(--font-family);
+
+ user-select: none;
+
&:hover {
transition: all 150ms ease-out;
}
@@ -266,14 +274,6 @@
}
}
- border-radius: 0.5rem;
- border-width: 1px;
- border-style: solid;
-
- font-family: var(--font-family);
-
- user-select: none;
-
&--size-large {
font-weight: 600;
font-size: 0.875rem;
diff --git a/packages/excalidraw/components/FixedSideContainer.scss b/packages/excalidraw/components/FixedSideContainer.scss
index cc99d47d50..15710a551e 100644
--- a/packages/excalidraw/components/FixedSideContainer.scss
+++ b/packages/excalidraw/components/FixedSideContainer.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.FixedSideContainer {
diff --git a/packages/excalidraw/components/FontPicker/FontPicker.scss b/packages/excalidraw/components/FontPicker/FontPicker.scss
index 70859e8091..19492772ab 100644
--- a/packages/excalidraw/components/FontPicker/FontPicker.scss
+++ b/packages/excalidraw/components/FontPicker/FontPicker.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.FontPicker__container {
diff --git a/packages/excalidraw/components/HelpDialog.scss b/packages/excalidraw/components/HelpDialog.scss
index ce4dd441af..dfdd3d0437 100644
--- a/packages/excalidraw/components/HelpDialog.scss
+++ b/packages/excalidraw/components/HelpDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.HelpDialog {
@@ -60,11 +60,12 @@
&__islands-container {
display: grid;
+ grid-column-gap: 1.5rem;
+ grid-row-gap: 2rem;
+
@media screen and (min-width: 1024px) {
grid-template-columns: 1fr 1fr;
}
- grid-column-gap: 1.5rem;
- grid-row-gap: 2rem;
}
@media screen and (min-width: 1024px) {
diff --git a/packages/excalidraw/components/HintViewer.scss b/packages/excalidraw/components/HintViewer.scss
index bb18bf5a54..b363fe1454 100644
--- a/packages/excalidraw/components/HintViewer.scss
+++ b/packages/excalidraw/components/HintViewer.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
// this is loosely based on the longest hint text
$wide-viewport-width: 1000px;
diff --git a/packages/excalidraw/components/IconPicker.scss b/packages/excalidraw/components/IconPicker.scss
index b9b47b39e6..80413e041d 100644
--- a/packages/excalidraw/components/IconPicker.scss
+++ b/packages/excalidraw/components/IconPicker.scss
@@ -1,10 +1,11 @@
-@import "../css/variables.module.scss";
+@use "sass:color";
+@use "../css/variables.module" as *;
.excalidraw {
.picker {
padding: 0.5rem;
background: var(--popup-bg-color);
- border: 0 solid transparentize($oc-white, 0.75);
+ border: 0 solid color.adjust(#fff, $alpha: -0.75);
box-shadow: var(--shadow-island);
border-radius: 4px;
position: absolute;
@@ -87,7 +88,7 @@
}
.picker-type-elementBackground .picker-keybinding {
- color: $oc-white;
+ color: #fff;
}
.picker-swatch[aria-label="transparent"] .picker-keybinding {
@@ -100,10 +101,10 @@
&.theme--dark {
.picker-type-elementBackground .picker-keybinding {
- color: $oc-black;
+ color: #000;
}
.picker-swatch[aria-label="transparent"] .picker-keybinding {
- color: $oc-black;
+ color: #000;
}
}
}
diff --git a/packages/excalidraw/components/ImageExportDialog.scss b/packages/excalidraw/components/ImageExportDialog.scss
index ea9e74f805..f20220e943 100644
--- a/packages/excalidraw/components/ImageExportDialog.scss
+++ b/packages/excalidraw/components/ImageExportDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--ImageExportModal-preview-border: #d6d6d6;
diff --git a/packages/excalidraw/components/LayerUI.scss b/packages/excalidraw/components/LayerUI.scss
index 7ee1469e23..5c76a1ee28 100644
--- a/packages/excalidraw/components/LayerUI.scss
+++ b/packages/excalidraw/components/LayerUI.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color";
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.layer-ui__wrapper.animate {
diff --git a/packages/excalidraw/components/LibraryMenu.scss b/packages/excalidraw/components/LibraryMenu.scss
index d0d33befd8..6133bb2ecf 100644
--- a/packages/excalidraw/components/LibraryMenu.scss
+++ b/packages/excalidraw/components/LibraryMenu.scss
@@ -1,4 +1,4 @@
-@import "open-color/open-color";
+@use "../css/variables.module" as *;
.excalidraw {
.layer-ui__library {
@@ -46,15 +46,15 @@
}
&-close.ToolIcon_type_button {
- background-color: $oc-blue-6;
+ background-color: $color-blue-6;
align-self: flex-end;
&:hover {
- background-color: $oc-blue-8;
+ background-color: $color-blue-8;
}
.ToolIcon__icon {
width: auto;
font-size: 1rem;
- color: $oc-white;
+ color: #fff;
padding: 0 0.5rem;
}
}
@@ -90,7 +90,7 @@
border-radius: var(--border-radius-lg);
background-color: var(--color-primary);
- color: $oc-white;
+ color: #fff;
text-align: center;
white-space: nowrap;
text-decoration: none !important;
diff --git a/packages/excalidraw/components/LibraryMenuItems.scss b/packages/excalidraw/components/LibraryMenuItems.scss
index 3e67774348..a1e5c0da42 100644
--- a/packages/excalidraw/components/LibraryMenuItems.scss
+++ b/packages/excalidraw/components/LibraryMenuItems.scss
@@ -1,4 +1,4 @@
-@import "open-color/open-color";
+@use "../css/variables.module" as *;
.excalidraw {
--container-padding-y: 1rem;
diff --git a/packages/excalidraw/components/LibraryUnit.scss b/packages/excalidraw/components/LibraryUnit.scss
index a0d2161c21..286a00fc5f 100644
--- a/packages/excalidraw/components/LibraryUnit.scss
+++ b/packages/excalidraw/components/LibraryUnit.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.library-unit {
diff --git a/packages/excalidraw/components/MobileToolBar.scss b/packages/excalidraw/components/MobileToolBar.scss
index b936c70ebd..985c676eee 100644
--- a/packages/excalidraw/components/MobileToolBar.scss
+++ b/packages/excalidraw/components/MobileToolBar.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color.scss";
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.mobile-toolbar {
diff --git a/packages/excalidraw/components/Modal.scss b/packages/excalidraw/components/Modal.scss
index 1a355e2e11..9154079e28 100644
--- a/packages/excalidraw/components/Modal.scss
+++ b/packages/excalidraw/components/Modal.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
&.excalidraw-modal-container {
diff --git a/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.scss b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.scss
index 4aad0cbdfd..2ede157e3a 100644
--- a/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.scss
+++ b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.OverwriteConfirm {
diff --git a/packages/excalidraw/components/PasteChartDialog.scss b/packages/excalidraw/components/PasteChartDialog.scss
index 855b4ad7cd..3bd21b02be 100644
--- a/packages/excalidraw/components/PasteChartDialog.scss
+++ b/packages/excalidraw/components/PasteChartDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.PasteChartDialog {
@@ -25,7 +25,7 @@
height: 128px;
border-radius: 2px;
padding: 1px;
- border: 1px solid $oc-gray-4;
+ border: 1px solid $color-gray-4;
display: flex;
align-items: center;
justify-content: center;
@@ -39,7 +39,7 @@
}
&:hover {
padding: 0;
- border: 2px solid $oc-blue-5;
+ border: 2px solid $color-blue-5;
}
}
}
diff --git a/packages/excalidraw/components/PasteChartDialog.tsx b/packages/excalidraw/components/PasteChartDialog.tsx
index 2566017ac9..2db632a63b 100644
--- a/packages/excalidraw/components/PasteChartDialog.tsx
+++ b/packages/excalidraw/components/PasteChartDialog.tsx
@@ -1,4 +1,3 @@
-import oc from "open-color";
import React, { useLayoutEffect, useRef, useState } from "react";
import type { ChartType } from "@excalidraw/element/types";
@@ -49,7 +48,7 @@ const ChartPreviewBtn = (props: {
elements,
{
exportBackground: false,
- viewBackgroundColor: oc.white,
+ viewBackgroundColor: "#fff",
},
null, // files
{
diff --git a/packages/excalidraw/components/PublishLibrary.scss b/packages/excalidraw/components/PublishLibrary.scss
index fdcacf1291..c2746f5874 100644
--- a/packages/excalidraw/components/PublishLibrary.scss
+++ b/packages/excalidraw/components/PublishLibrary.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.publish-library {
@@ -14,7 +14,7 @@
span {
font-weight: 500;
font-size: 1rem;
- color: $oc-gray-6;
+ color: $color-gray-6;
}
input,
textarea {
@@ -24,7 +24,7 @@
}
.required {
- color: $oc-red-8;
+ color: $color-red-8;
margin: 0.2rem;
}
}
@@ -48,22 +48,22 @@
}
&--confirm.ToolIcon_type_button {
- background-color: $oc-blue-6;
+ background-color: $color-blue-6;
&:hover {
- background-color: $oc-blue-8;
+ background-color: $color-blue-8;
}
}
&--cancel.ToolIcon_type_button {
- background-color: $oc-gray-5;
+ background-color: $color-gray-5;
&:hover {
- background-color: $oc-gray-6;
+ background-color: $color-gray-6;
}
}
.ToolIcon__icon {
- color: $oc-white;
+ color: #fff;
.Spinner {
--spinner-color: #fff;
svg {
@@ -83,7 +83,7 @@
}
&-warning {
- color: $oc-red-6;
+ color: $color-red-6;
}
&-note {
@@ -102,14 +102,14 @@
top: 0.3rem;
left: 0.3rem;
font-size: 0.7rem;
- color: $oc-red-7;
+ color: $color-red-7;
background: rgba(255, 255, 255, 0.9);
padding: 0.1rem 0.2rem;
border-radius: 0.2rem;
}
&__svg {
- background-color: $oc-white;
+ background-color: #fff;
padding: 0.3rem;
width: 7.5rem;
height: 7.5rem;
@@ -121,7 +121,7 @@
}
.ToolIcon__icon {
- background-color: $oc-white;
+ background-color: #fff;
width: auto;
height: auto;
margin: 0 0.5rem;
@@ -132,7 +132,7 @@
}
.required,
.error {
- color: $oc-red-8;
+ color: $color-red-8;
font-weight: 700;
font-size: 1rem;
margin: 0.2rem;
@@ -152,16 +152,16 @@
margin: 0;
}
.ToolIcon__icon {
- background-color: $oc-red-6;
+ background-color: $color-red-6;
&:hover {
- background-color: $oc-red-7;
+ background-color: $color-red-7;
}
&:active {
- background-color: $oc-red-8;
+ background-color: $color-red-8;
}
}
svg {
- color: $oc-white;
+ color: #fff;
padding: 0.26rem;
border-radius: 0.3em;
width: 1rem;
diff --git a/packages/excalidraw/components/PublishLibrary.tsx b/packages/excalidraw/components/PublishLibrary.tsx
index cdc038dac3..0376f812a5 100644
--- a/packages/excalidraw/components/PublishLibrary.tsx
+++ b/packages/excalidraw/components/PublishLibrary.tsx
@@ -1,5 +1,4 @@
import { exportToCanvas, exportToSvg } from "@excalidraw/utils/export";
-import OpenColor from "open-color";
import { useCallback, useEffect, useRef, useState } from "react";
import {
@@ -57,7 +56,7 @@ const generatePreviewImage = async (libraryItems: LibraryItems) => {
const ctx = canvas.getContext("2d")!;
- ctx.fillStyle = OpenColor.white;
+ ctx.fillStyle = "#fff";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// draw items
@@ -87,7 +86,7 @@ const generatePreviewImage = async (libraryItems: LibraryItems) => {
// draw item border
// -------------------------------------------------------------------------
ctx.lineWidth = BORDER_WIDTH;
- ctx.strokeStyle = OpenColor.gray[4];
+ ctx.strokeStyle = "#ced4da";
ctx.strokeRect(
colOffset + BOX_PADDING / 2,
rowOffset + BOX_PADDING / 2,
@@ -131,7 +130,7 @@ const SingleLibraryItem = ({
elements: libItem.elements,
appState: {
...appState,
- viewBackgroundColor: OpenColor.white,
+ viewBackgroundColor: "#fff",
exportBackground: true,
},
files: null,
@@ -175,7 +174,7 @@ const SingleLibraryItem = ({
}}
>
-
+
{t("publishDialog.itemName")}
diff --git a/packages/excalidraw/components/RadioGroup.scss b/packages/excalidraw/components/RadioGroup.scss
index 76ee20a16a..28ddc8889b 100644
--- a/packages/excalidraw/components/RadioGroup.scss
+++ b/packages/excalidraw/components/RadioGroup.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--RadioGroup-background: var(--island-bg-color);
diff --git a/packages/excalidraw/components/Range.scss b/packages/excalidraw/components/Range.scss
index 8dcc705fea..7849763345 100644
--- a/packages/excalidraw/components/Range.scss
+++ b/packages/excalidraw/components/Range.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--slider-thumb-size: 16px;
diff --git a/packages/excalidraw/components/SVGLayer.scss b/packages/excalidraw/components/SVGLayer.scss
index 1ab5a6347b..e7121afd19 100644
--- a/packages/excalidraw/components/SVGLayer.scss
+++ b/packages/excalidraw/components/SVGLayer.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.SVGLayer {
diff --git a/packages/excalidraw/components/SearchMenu.scss b/packages/excalidraw/components/SearchMenu.scss
index 4f9e36a668..707861c309 100644
--- a/packages/excalidraw/components/SearchMenu.scss
+++ b/packages/excalidraw/components/SearchMenu.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color";
-@import "../css//variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.layer-ui__search {
diff --git a/packages/excalidraw/components/ShareableLinkDialog.scss b/packages/excalidraw/components/ShareableLinkDialog.scss
index 2bdaaf0b78..f61ab1b825 100644
--- a/packages/excalidraw/components/ShareableLinkDialog.scss
+++ b/packages/excalidraw/components/ShareableLinkDialog.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.ShareableLinkDialog {
diff --git a/packages/excalidraw/components/Sidebar/Sidebar.scss b/packages/excalidraw/components/Sidebar/Sidebar.scss
index 2fba020ca9..db26c14ffe 100644
--- a/packages/excalidraw/components/Sidebar/Sidebar.scss
+++ b/packages/excalidraw/components/Sidebar/Sidebar.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color";
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.sidebar {
@@ -19,6 +18,12 @@
pointer-events: var(--ui-pointerEvents);
+ overflow: hidden;
+ border-radius: 0;
+ width: calc(var(--right-sidebar-width) - var(--space-factor) * 2);
+
+ border-left: 1px solid var(--sidebar-border-color);
+
:root[dir="rtl"] & {
left: 0;
right: auto;
@@ -28,12 +33,6 @@
box-shadow: none;
}
- overflow: hidden;
- border-radius: 0;
- width: calc(var(--right-sidebar-width) - var(--space-factor) * 2);
-
- border-left: 1px solid var(--sidebar-border-color);
-
:root[dir="rtl"] & {
border-right: 1px solid var(--sidebar-border-color);
border-left: 0;
diff --git a/packages/excalidraw/components/Sidebar/SidebarTrigger.scss b/packages/excalidraw/components/Sidebar/SidebarTrigger.scss
index 5b003cdc5d..6deaa54d66 100644
--- a/packages/excalidraw/components/Sidebar/SidebarTrigger.scss
+++ b/packages/excalidraw/components/Sidebar/SidebarTrigger.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.sidebar-trigger {
diff --git a/packages/excalidraw/components/Spinner.scss b/packages/excalidraw/components/Spinner.scss
index e2d90f8811..5f371b0494 100644
--- a/packages/excalidraw/components/Spinner.scss
+++ b/packages/excalidraw/components/Spinner.scss
@@ -1,4 +1,4 @@
-@import "open-color/open-color.scss";
+@use "../css/variables.module" as *;
$duration: 1.6s;
diff --git a/packages/excalidraw/components/Switch.scss b/packages/excalidraw/components/Switch.scss
index 894f806060..3c56cd5fd1 100644
--- a/packages/excalidraw/components/Switch.scss
+++ b/packages/excalidraw/components/Switch.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--Switch-disabled-color: var(--color-border-outline);
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialog.scss b/packages/excalidraw/components/TTDDialog/TTDDialog.scss
index 37ec33698a..b92c7f6d3c 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialog.scss
+++ b/packages/excalidraw/components/TTDDialog/TTDDialog.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
$verticalBreakpoint: 861px;
@@ -241,7 +241,7 @@ $verticalBreakpoint: 861px;
height: 2.5rem;
font-size: 12px;
- color: $oc-white;
+ color: #fff;
background-color: var(--color-primary);
width: 100%;
@@ -271,7 +271,9 @@ $verticalBreakpoint: 861px;
}
}
- position: relative;
+ & {
+ position: relative;
+ }
div {
display: contents;
diff --git a/packages/excalidraw/components/TextField.scss b/packages/excalidraw/components/TextField.scss
index fefea7e802..ea3ac3227d 100644
--- a/packages/excalidraw/components/TextField.scss
+++ b/packages/excalidraw/components/TextField.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--ExcTextField--color: var(--color-on-surface);
diff --git a/packages/excalidraw/components/TextInput.scss b/packages/excalidraw/components/TextInput.scss
index 60a03ca781..99cb8443ed 100644
--- a/packages/excalidraw/components/TextInput.scss
+++ b/packages/excalidraw/components/TextInput.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.TextInput {
diff --git a/packages/excalidraw/components/Toast.scss b/packages/excalidraw/components/Toast.scss
index 853871fd46..5d8cc8c1d2 100644
--- a/packages/excalidraw/components/Toast.scss
+++ b/packages/excalidraw/components/Toast.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.Toast {
diff --git a/packages/excalidraw/components/ToolIcon.scss b/packages/excalidraw/components/ToolIcon.scss
index dfba270b5b..191d866dd3 100644
--- a/packages/excalidraw/components/ToolIcon.scss
+++ b/packages/excalidraw/components/ToolIcon.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color.scss";
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.ToolIcon {
diff --git a/packages/excalidraw/components/ToolPopover.scss b/packages/excalidraw/components/ToolPopover.scss
index d049704bb7..a9f1fc359d 100644
--- a/packages/excalidraw/components/ToolPopover.scss
+++ b/packages/excalidraw/components/ToolPopover.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.tool-popover-content {
diff --git a/packages/excalidraw/components/Toolbar.scss b/packages/excalidraw/components/Toolbar.scss
index 3919176bbb..4f4e97e1a0 100644
--- a/packages/excalidraw/components/Toolbar.scss
+++ b/packages/excalidraw/components/Toolbar.scss
@@ -1,5 +1,4 @@
-@import "open-color/open-color.scss";
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.App-toolbar {
diff --git a/packages/excalidraw/components/Tooltip.scss b/packages/excalidraw/components/Tooltip.scss
index 37fc3368ec..33af7fd710 100644
--- a/packages/excalidraw/components/Tooltip.scss
+++ b/packages/excalidraw/components/Tooltip.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
// container in body where the actual tooltip is appended to
.excalidraw-tooltip {
@@ -14,13 +14,13 @@
pointer-events: none;
word-wrap: break-word;
- background: $oc-black;
+ background: #000;
line-height: 1.5;
text-align: center;
font-size: 13px;
font-weight: 500;
- color: $oc-white;
+ color: #fff;
display: none;
diff --git a/packages/excalidraw/components/UnlockPopup.scss b/packages/excalidraw/components/UnlockPopup.scss
index 3dd7f8c7bb..d4f8452f6a 100644
--- a/packages/excalidraw/components/UnlockPopup.scss
+++ b/packages/excalidraw/components/UnlockPopup.scss
@@ -1,4 +1,4 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
.UnlockPopup {
diff --git a/packages/excalidraw/components/UserList.scss b/packages/excalidraw/components/UserList.scss
index 025f4d16ec..af0d1f74fe 100644
--- a/packages/excalidraw/components/UserList.scss
+++ b/packages/excalidraw/components/UserList.scss
@@ -1,10 +1,22 @@
-@import "../css/variables.module.scss";
+@use "../css/variables.module" as *;
.excalidraw {
--avatar-size: 1.75rem;
--avatarList-gap: 0.625rem;
--userList-padding: var(--space-factor);
+ --userlist-hint-bg-color: var(--color-gray-10);
+ --userlist-hint-heading-color: var(--color-gray-80);
+ --userlist-hint-text-color: var(--color-gray-60);
+ --userlist-collaborators-border-color: var(--color-gray-20);
+
+ &.theme--dark {
+ --userlist-hint-bg-color: var(--color-gray-90);
+ --userlist-hint-heading-color: var(--color-gray-30);
+ --userlist-hint-text-color: var(--color-gray-40);
+ --userlist-collaborators-border-color: var(--color-gray-80);
+ }
+
.UserList__wrapper {
display: flex;
width: 100%;
@@ -50,13 +62,16 @@
.UserList__more {
@include avatarStyles;
- background-color: var(--color-gray-20);
- border: 0 !important;
- font-size: 0.625rem;
- font-weight: 400;
- flex-shrink: 0;
- color: var(--color-gray-100);
- font-weight: bold;
+
+ & {
+ background-color: var(--color-gray-20);
+ border: 0 !important;
+ font-size: 0.625rem;
+ font-weight: 400;
+ flex-shrink: 0;
+ color: var(--color-gray-100);
+ font-weight: bold;
+ }
}
.UserList__collaborator-name {
@@ -141,18 +156,6 @@
}
}
- --userlist-hint-bg-color: var(--color-gray-10);
- --userlist-hint-heading-color: var(--color-gray-80);
- --userlist-hint-text-color: var(--color-gray-60);
- --userlist-collaborators-border-color: var(--color-gray-20);
-
- &.theme--dark {
- --userlist-hint-bg-color: var(--color-gray-90);
- --userlist-hint-heading-color: var(--color-gray-30);
- --userlist-hint-text-color: var(--color-gray-40);
- --userlist-collaborators-border-color: var(--color-gray-80);
- }
-
.UserList__collaborators {
top: auto;
max-height: 50vh;
diff --git a/packages/excalidraw/components/dropdownMenu/DropdownMenu.scss b/packages/excalidraw/components/dropdownMenu/DropdownMenu.scss
index f6c7d7dc24..85cab103a7 100644
--- a/packages/excalidraw/components/dropdownMenu/DropdownMenu.scss
+++ b/packages/excalidraw/components/dropdownMenu/DropdownMenu.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.dropdown-menu {
diff --git a/packages/excalidraw/components/footer/FooterCenter.scss b/packages/excalidraw/components/footer/FooterCenter.scss
index ce65659227..7fd17a5edc 100644
--- a/packages/excalidraw/components/footer/FooterCenter.scss
+++ b/packages/excalidraw/components/footer/FooterCenter.scss
@@ -1,11 +1,12 @@
.footer-center {
pointer-events: none;
- & > * {
- pointer-events: var(--ui-pointerEvents);
- }
display: flex;
width: 100%;
justify-content: flex-start;
margin-inline-end: 0.6rem;
+
+ & > * {
+ pointer-events: var(--ui-pointerEvents);
+ }
}
diff --git a/packages/excalidraw/components/hyperlink/Hyperlink.scss b/packages/excalidraw/components/hyperlink/Hyperlink.scss
index 6a5db325a7..ff7517c7af 100644
--- a/packages/excalidraw/components/hyperlink/Hyperlink.scss
+++ b/packages/excalidraw/components/hyperlink/Hyperlink.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw-hyperlinkContainer {
display: flex;
@@ -47,16 +47,16 @@
}
button {
- color: $oc-blue-6;
+ color: $color-blue-6;
background-color: transparent !important;
font-weight: 500;
&.excalidraw-hyperlinkContainer--remove {
- color: $oc-red-9;
+ color: $color-red-9;
}
}
&--remove .ToolIcon__icon svg {
- color: $oc-red-6;
+ color: $color-red-6;
}
.ToolIcon__icon {
diff --git a/packages/excalidraw/components/icons.tsx b/packages/excalidraw/components/icons.tsx
index f2ecf02963..848583d188 100644
--- a/packages/excalidraw/components/icons.tsx
+++ b/packages/excalidraw/components/icons.tsx
@@ -7,7 +7,6 @@
// to determine whether or not the icons should be mirrored in right-to-left languages.
import clsx from "clsx";
-import oc from "open-color";
import React from "react";
import { THEME } from "@excalidraw/common";
@@ -17,7 +16,7 @@ import type { Theme } from "@excalidraw/element/types";
export const iconFillColor = (theme: Theme) => "var(--icon-fill-color)";
const handlerColor = (theme: Theme) =>
- theme === THEME.LIGHT ? oc.white : "#1e1e1e";
+ theme === THEME.LIGHT ? "#fff" : "#1e1e1e";
type Opts = {
width?: number;
diff --git a/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.scss b/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.scss
index 573fbccce6..4c9d7b284c 100644
--- a/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.scss
+++ b/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.scss
@@ -1,4 +1,4 @@
-@import "../../css/variables.module.scss";
+@use "../../css/variables.module" as *;
.excalidraw {
.collab-button {
@@ -58,8 +58,8 @@
bottom: -5px;
padding: 3px;
border-radius: 50%;
- background-color: $oc-green-2;
- color: $oc-green-9;
+ background-color: $color-green-2;
+ color: $color-green-9;
font-size: 0.6rem;
font-family: "Cascadia";
}
diff --git a/packages/excalidraw/css/app.scss b/packages/excalidraw/css/app.scss
index 62e5d4699d..399b6a21d4 100644
--- a/packages/excalidraw/css/app.scss
+++ b/packages/excalidraw/css/app.scss
@@ -1,5 +1,3 @@
-@import "open-color/open-color.scss";
-
.visually-hidden {
position: absolute !important;
height: 1px;
diff --git a/packages/excalidraw/css/styles.scss b/packages/excalidraw/css/styles.scss
index 2d8f3b7e7d..5557d50313 100644
--- a/packages/excalidraw/css/styles.scss
+++ b/packages/excalidraw/css/styles.scss
@@ -1,5 +1,5 @@
-@import "./variables.module.scss";
-@import "./theme";
+@use "./variables.module" as *;
+@use "./theme";
:root {
--zIndex-canvas: 1;
@@ -210,7 +210,7 @@ body.excalidraw-cursor-resize * {
.divider {
width: 1px;
- background-color: $oc-gray-2;
+ background-color: $color-gray-2;
margin: 1px;
}
@@ -729,8 +729,8 @@ body.excalidraw-cursor-resize * {
justify-content: center;
padding: 40px;
- background-color: $oc-red-1;
- border: 3px solid $oc-red-9;
+ background-color: $color-red-1;
+ border: 3px solid $color-red-9;
}
.ErrorSplash-paragraph {
diff --git a/packages/excalidraw/css/theme.scss b/packages/excalidraw/css/theme.scss
index 223cd8eb6e..2dc3164ba2 100644
--- a/packages/excalidraw/css/theme.scss
+++ b/packages/excalidraw/css/theme.scss
@@ -1,35 +1,36 @@
-@import "open-color/open-color.scss";
-@import "./variables.module.scss";
+@use "sass:color";
+@use "./variables.module" as *;
+@forward "./variables.module";
.excalidraw {
--theme-filter: none;
- --button-destructive-bg-color: #{$oc-red-1};
- --button-destructive-color: #{$oc-red-9};
- --button-gray-1: #{$oc-gray-2};
- --button-gray-2: #{$oc-gray-4};
- --button-gray-3: #{$oc-gray-5};
+ --button-destructive-bg-color: #{$color-red-1};
+ --button-destructive-color: #{$color-red-9};
+ --button-gray-1: #{$color-gray-2};
+ --button-gray-2: #{$color-gray-4};
+ --button-gray-3: #{$color-gray-5};
--mobile-action-button-bg: rgba(255, 255, 255, 0.35);
--mobile-color-border: var(--default-border-color);
- --button-special-active-bg-color: #{$oc-green-0};
+ --button-special-active-bg-color: #{$color-green-0};
--dialog-border-color: var(--color-gray-20);
--dropdown-icon: url('data:image/svg+xml,');
- --focus-highlight-color: #{$oc-blue-2};
+ --focus-highlight-color: #{$color-blue-2};
--icon-fill-color: var(--color-on-surface);
- --icon-green-fill-color: #{$oc-green-9};
- --default-bg-color: #{$oc-white};
- --input-bg-color: #{$oc-white};
- --input-border-color: #{$oc-gray-4};
- --input-hover-bg-color: #{$oc-gray-1};
- --input-label-color: #{$oc-gray-7};
+ --icon-green-fill-color: #{$color-green-9};
+ --default-bg-color: #fff;
+ --input-bg-color: #fff;
+ --input-border-color: #{$color-gray-4};
+ --input-hover-bg-color: #{$color-gray-1};
+ --input-label-color: #{$color-gray-7};
--island-bg-color: #ffffff;
--keybinding-color: var(--color-gray-40);
- --link-color: #{$oc-blue-7};
- --overlay-bg-color: #{transparentize($oc-white, 0.12)};
+ --link-color: #{$color-blue-7};
+ --overlay-bg-color: #{color.adjust(#fff, $alpha: -0.12)};
--popup-bg-color: var(--island-bg-color);
- --popup-secondary-bg-color: #{$oc-gray-1};
- --popup-text-color: #{$oc-black};
- --popup-text-inverted-color: #{$oc-white};
- --select-highlight-color: #{$oc-blue-5};
+ --popup-secondary-bg-color: #{$color-gray-1};
+ --popup-text-color: #000;
+ --popup-text-inverted-color: #fff;
+ --select-highlight-color: #{$color-blue-5};
--shadow-island: 0px 0px 0.9310142993927002px 0px rgba(0, 0, 0, 0.17),
0px 0px 3.1270833015441895px 0px rgba(0, 0, 0, 0.08),
0px 7px 14px 0px rgba(0, 0, 0, 0.05);
@@ -46,17 +47,6 @@
--editor-container-padding: 1rem;
--mobile-action-button-size: 2rem;
- @include isMobile {
- --editor-container-padding: 0.75rem;
- }
-
- @media screen and (min-device-width: 1921px) {
- --lg-button-size: 2.5rem;
- --lg-icon-size: 1.25rem;
- --default-button-size: 2.25rem;
- --default-icon-size: 1.25rem;
- }
-
--scrollbar-thumb: var(--button-gray-2);
--scrollbar-thumb-hover: var(--button-gray-3);
@@ -87,7 +77,7 @@
--color-selection: #6965db;
- --color-icon-white: #{$oc-white};
+ --color-icon-white: #fff;
--color-primary: #6965db;
--color-primary-darker: #5b57d1;
@@ -170,6 +160,17 @@
--color-badge: #0b6513;
--background-color-badge: #d3ffd2;
+ @include isMobile {
+ --editor-container-padding: 0.75rem;
+ }
+
+ @media screen and (min-device-width: 1921px) {
+ --lg-button-size: 2.5rem;
+ --lg-icon-size: 1.25rem;
+ --default-button-size: 2.25rem;
+ --default-icon-size: 1.25rem;
+ }
+
&.theme--dark {
&.theme--dark-background-none {
background: none;
@@ -179,7 +180,7 @@
&.theme--dark {
--theme-filter: invert(93%) hue-rotate(180deg);
--button-destructive-bg-color: #5a0000;
- --button-destructive-color: #{$oc-red-3};
+ --button-destructive-color: #{$color-red-3};
--button-gray-1: #363636;
--button-gray-2: #272727;
@@ -189,21 +190,21 @@
--button-special-active-bg-color: #204624;
--dialog-border-color: var(--color-gray-80);
--dropdown-icon: url('data:image/svg+xml,');
- --focus-highlight-color: #{$oc-blue-6};
- --icon-green-fill-color: #{$oc-green-4};
+ --focus-highlight-color: #{$color-blue-6};
+ --icon-green-fill-color: #{$color-green-4};
--default-bg-color: #121212;
--input-bg-color: #121212;
--input-border-color: #2e2e2e;
--input-hover-bg-color: #181818;
- --input-label-color: #{$oc-gray-2};
+ --input-label-color: #{$color-gray-2};
--island-bg-color: #232329;
--keybinding-color: var(--color-gray-60);
- --link-color: #{$oc-blue-4};
- --overlay-bg-color: #{transparentize($oc-gray-8, 0.88)};
+ --link-color: #{$color-blue-4};
+ --overlay-bg-color: #{color.adjust($color-gray-8, $alpha: -0.88)};
--popup-secondary-bg-color: #222;
- --popup-text-color: #{$oc-gray-4};
+ --popup-text-color: #{$color-gray-4};
--popup-text-inverted-color: #2c2c2c;
- --select-highlight-color: #{$oc-blue-4};
+ --select-highlight-color: #{$color-blue-4};
--shadow-island: 0px 0px 0.9310142993927002px 0px rgba(0, 0, 0, 0.17),
0px 0px 3.1270833015441895px 0px rgba(0, 0, 0, 0.08),
0px 7px 14px 0px rgba(0, 0, 0, 0.05);
@@ -216,8 +217,8 @@
0px 2.76726px 2.21381px rgba(0, 0, 0, 0.0196802);
--avatar-border-color: var(--color-gray-85);
- --scrollbar-thumb: #{$oc-gray-8};
- --scrollbar-thumb-hover: #{$oc-gray-7};
+ --scrollbar-thumb: #{$color-gray-8};
+ --scrollbar-thumb-hover: #{$color-gray-7};
--color-slider-track: hsl(244, 23%, 39%);
diff --git a/packages/excalidraw/css/variables.module.scss b/packages/excalidraw/css/variables.module.scss
index 15d0768adb..433a82d89c 100644
--- a/packages/excalidraw/css/variables.module.scss
+++ b/packages/excalidraw/css/variables.module.scss
@@ -1,4 +1,27 @@
-@import "open-color/open-color.scss";
+$color-red-1: #ffe3e3;
+$color-red-3: #ffa8a8;
+$color-red-6: #fa5252;
+$color-red-7: #f03e3e;
+$color-red-8: #e03131;
+$color-red-9: #c92a2a;
+$color-gray-1: #f1f3f5;
+$color-gray-2: #e9ecef;
+$color-gray-4: #ced4da;
+$color-gray-5: #adb5bd;
+$color-gray-6: #868e96;
+$color-gray-7: #495057;
+$color-gray-8: #343a40;
+$color-green-0: #ebfbee;
+$color-green-2: #b2f2bb;
+$color-green-4: #69db7c;
+$color-green-9: #2b8a3e;
+$color-blue-1: #d0ebff;
+$color-blue-2: #a5d8ff;
+$color-blue-4: #4dabf7;
+$color-blue-5: #339af0;
+$color-blue-6: #228be6;
+$color-blue-7: #1c7ed6;
+$color-blue-8: #1971c2;
@mixin isMobile() {
@at-root .excalidraw--mobile#{&} {
@@ -137,7 +160,10 @@
@mixin outlineButtonIconStyles {
@include outlineButtonStyles;
- padding: 0;
+
+ & {
+ padding: 0;
+ }
svg {
width: var(--default-icon-size);
diff --git a/packages/excalidraw/cursor.ts b/packages/excalidraw/cursor.ts
index 7125ccedf3..edf985822a 100644
--- a/packages/excalidraw/cursor.ts
+++ b/packages/excalidraw/cursor.ts
@@ -1,5 +1,3 @@
-import OpenColor from "open-color";
-
import { CURSOR_TYPE, MIME_TYPES, THEME } from "@excalidraw/common";
import { isHandToolActive, isEraserActive } from "./appState";
@@ -60,9 +58,9 @@ export const setEraserCursor = (
0,
2 * Math.PI,
);
- context.fillStyle = isDarkTheme ? OpenColor.black : OpenColor.white;
+ context.fillStyle = isDarkTheme ? "#000" : "#fff";
context.fill();
- context.strokeStyle = isDarkTheme ? OpenColor.white : OpenColor.black;
+ context.strokeStyle = isDarkTheme ? "#fff" : "#000";
context.stroke();
previewDataURL = eraserCanvasCache.toDataURL(MIME_TYPES.svg) as DataURL;
};
diff --git a/packages/excalidraw/package.json b/packages/excalidraw/package.json
index 5f3d6b2684..87a403e93c 100644
--- a/packages/excalidraw/package.json
+++ b/packages/excalidraw/package.json
@@ -100,7 +100,6 @@
"lodash.debounce": "4.0.8",
"lodash.throttle": "4.1.1",
"nanoid": "3.3.3",
- "open-color": "1.9.1",
"pako": "2.0.3",
"perfect-freehand": "1.2.0",
"pica": "7.1.1",
diff --git a/packages/excalidraw/renderer/interactiveScene.ts b/packages/excalidraw/renderer/interactiveScene.ts
index 77df6f768b..5f314c2557 100644
--- a/packages/excalidraw/renderer/interactiveScene.ts
+++ b/packages/excalidraw/renderer/interactiveScene.ts
@@ -6,7 +6,6 @@ import {
type LocalPoint,
type Radians,
} from "@excalidraw/math";
-import oc from "open-color";
import {
arrayToMap,
@@ -1301,7 +1300,7 @@ const _renderInteractiveScene = ({
elementsMap,
);
}
- const selectionColor = renderConfig.selectionColor || oc.black;
+ const selectionColor = renderConfig.selectionColor || "#000";
if (showBoundingBox) {
// Optimisation for finding quickly relevant element ids
@@ -1384,7 +1383,7 @@ const _renderInteractiveScene = ({
y2,
selectionColors: groupElements.some((el) => el.locked)
? ["#ced4da"]
- : [oc.black],
+ : ["#000"],
dashed: true,
cx: x1 + (x2 - x1) / 2,
cy: y1 + (y2 - y1) / 2,
@@ -1410,7 +1409,7 @@ const _renderInteractiveScene = ({
context.translate(appState.scrollX, appState.scrollY);
if (selectedElements.length === 1) {
- context.fillStyle = oc.white;
+ context.fillStyle = "#fff";
const transformHandles = getTransformHandles(
selectedElements[0],
appState.zoom,
@@ -1455,7 +1454,7 @@ const _renderInteractiveScene = ({
) {
const dashedLinePadding =
(DEFAULT_TRANSFORM_HANDLE_SPACING * 2) / appState.zoom.value;
- context.fillStyle = oc.white;
+ context.fillStyle = "#fff";
const [x1, y1, x2, y2] = getCommonBounds(selectedElements, elementsMap);
const initialLineDash = context.getLineDash();
context.setLineDash([2 / appState.zoom.value]);
diff --git a/packages/excalidraw/tests/colorInput.test.ts b/packages/excalidraw/tests/colorInput.test.ts
index c2e3ae82b8..853e7c1a51 100644
--- a/packages/excalidraw/tests/colorInput.test.ts
+++ b/packages/excalidraw/tests/colorInput.test.ts
@@ -1,4 +1,4 @@
-import { normalizeInputColor } from "../components/ColorPicker/ColorInput";
+import { normalizeInputColor } from "@excalidraw/common";
describe("normalizeInputColor", () => {
describe("hex colors", () => {
diff --git a/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx b/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx
index 2a9001f1d9..d4c883cd13 100644
--- a/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx
+++ b/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx
@@ -5,13 +5,13 @@ import { getOriginalContainerHeightFromCache } from "@excalidraw/element";
import {
CODES,
+ colorToHex,
KEYS,
FONT_FAMILY,
TEXT_ALIGN,
THEME,
VERTICAL_ALIGN,
applyDarkModeFilter,
- tinycolor,
} from "@excalidraw/common";
import type {
@@ -1672,7 +1672,7 @@ describe("textWysiwyg", () => {
// Helper to compare colors (browser may return rgb format)
const colorsAreEqual = (color1: string, color2: string) => {
- return tinycolor(color1).toHex() === tinycolor(color2).toHex();
+ return colorToHex(color1) === colorToHex(color2);
};
beforeEach(async () => {
diff --git a/packages/utils/package.json b/packages/utils/package.json
index ed4d6dd274..f571d42035 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -51,7 +51,6 @@
"@braintree/sanitize-url": "6.0.2",
"@excalidraw/laser-pointer": "1.3.1",
"browser-fs-access": "0.29.1",
- "open-color": "1.9.1",
"pako": "2.0.3",
"perfect-freehand": "1.2.0",
"png-chunk-text": "1.0.0",
diff --git a/scripts/buildPackage.js b/scripts/buildPackage.js
index 8a70f9f9be..96c97cbbd5 100644
--- a/scripts/buildPackage.js
+++ b/scripts/buildPackage.js
@@ -1,4 +1,6 @@
const path = require("path");
+const fs = require("fs");
+const { pathToFileURL } = require("url");
const { build } = require("esbuild");
const { sassPlugin } = require("esbuild-sass-plugin");
@@ -16,6 +18,44 @@ const ENV_VARS = {
},
};
+// Resolve a relative path from the source file's directory
+const resolveRelativePath = (importPath, sourceFile) => {
+ const sourceDir = path.dirname(sourceFile);
+ const extensions = [".scss", ".css", ""];
+
+ for (const ext of extensions) {
+ const fullPath = path.resolve(sourceDir, importPath + ext);
+ if (fs.existsSync(fullPath)) {
+ return fullPath;
+ }
+ // Try with underscore prefix for partials
+ const partialPath = path.join(
+ path.dirname(fullPath),
+ `_${path.basename(fullPath)}`,
+ );
+ if (fs.existsSync(partialPath)) {
+ return partialPath;
+ }
+ }
+ return null;
+};
+
+// Precompile function to convert relative paths to absolute paths
+const precompile = (source, sourcePath) => {
+ // Match @use and @forward statements with relative paths
+ const importRegex = /(@use|@forward)\s+["'](\.[^"']+)["']/g;
+
+ return source.replace(importRegex, (match, directive, importPath) => {
+ const resolvedPath = resolveRelativePath(importPath, sourcePath);
+ if (resolvedPath) {
+ // Convert to file:// URL format for sass
+ const fileUrl = pathToFileURL(resolvedPath).href;
+ return `${directive} "${fileUrl}"`;
+ }
+ return match;
+ });
+};
+
// excludes all external dependencies and bundles only the source code
const getConfig = (outdir) => ({
outdir,
@@ -23,7 +63,11 @@ const getConfig = (outdir) => ({
splitting: true,
format: "esm",
packages: "external",
- plugins: [sassPlugin()],
+ plugins: [
+ sassPlugin({
+ precompile,
+ }),
+ ],
target: "es2020",
assetNames: "[dir]/[name]",
chunkNames: "[dir]/[name]-[hash]",
diff --git a/yarn.lock b/yarn.lock
index 919192bd7e..76ecf628ac 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7616,11 +7616,6 @@ onetime@^5.1.0, onetime@^5.1.2:
dependencies:
mimic-fn "^2.1.0"
-open-color@1.9.1:
- version "1.9.1"
- resolved "https://registry.yarnpkg.com/open-color/-/open-color-1.9.1.tgz#a6e6328f60eff7aa60e3e8fcfa50f53ff3eece35"
- integrity sha512-vCseG/EQ6/RcvxhUcGJiHViOgrtz4x0XbZepXvKik66TMGkvbmjeJrKFyBEx6daG5rNyyd14zYXhz0hZVwQFOw==
-
opener@^1.5.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"