Socket
Socket
Sign inDemoInstall

@atlaskit/editor-palette

Package Overview
Dependencies
40
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @atlaskit/editor-palette

The editor palette


Version published
Weekly downloads
13K
decreased by-4.39%
Maintainers
1
Install size
16.6 MB
Created
Weekly downloads
 

Readme

Source

Editor palette

When adding support for themed content to tooling which interacts with adf content -- the decision was made to treat existing hex codes as a unique id, and link them to design tokens which have theme specific versions.

By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.

Usage

Detailed docs and example usage can be found here.

APIs

Installation

yarn add @atlaskit/editor-palette
hexToBackgroundPaletteColor

This takes an adf hex color and returns a matching background palette color.

import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';

const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
//     ^? const cssValue: 'var(--ds-surface, #FFFFFF)'
<div style={{backgroundColor: cssValue}} />

The names of tokens can change over time, and the values of tokens will differ between themes. The exact output of this function is an implementation detail and should only be used when rendering content to the user, on a client with a matching major version of @atlaskit/tokens.

  • DO NOT: store the output of these functions in any user-generated content or back-end.
  • DO: store the ADF hex color, and use these utilities at render time to display the themed version of the color
hexToTextPaletteColor

This takes an adf hex color and returns a matching text palette color.

import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';

const cssValue = hexToEditorTextPaletteColor('#0747A6');
//     ^? const cssValue: 'var(--ds-text-accent-blue, #0747A6)'
<span style={{textColor: cssValue}} />

The names of tokens can change over time, and the values of tokens will differ between themes. The exact output of this function is an implementation detail and should only be used when rendering content to the user, on a client with a matching major version of @atlaskit/tokens.

  • DO NOT: store the output of these functions in any user-generated content or back-end.
  • DO: store the ADF hex color, and use these utilities at render time to display the themed version of the color
hexToEditorBorderPaletteColor

This takes an adf hex color and returns a matching border palette color.

import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';

const cssValue = hexToEditorBorderPaletteColor('#091E4224');
//     ^? const cssValue: 'var(--ds-border, #091E4224)'
<span style={{borderColor: cssValue}} />

The names of tokens can change over time, and the values of tokens will differ between themes. The exact output of this function is an implementation detail and should only be used when rendering content to the user, on a client with a matching major version of @atlaskit/tokens.

  • DO NOT: store the output of these functions in any user-generated content or back-end.
  • DO: store the ADF hex color, and use these utilities at render time to display the themed version of the color

FAQs

Last updated on 02 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc