Radio Color System

0

10

20

30

40

50

60

70

80

90

100

0

10

20

30

40

50

60

70

80

90

100

palette
Hue
Show palette expand_more
palette primary
0
10
20
30
40
50
60
70
80
90
100
palette secondary
0
10
20
30
40
50
60
70
80
90
100
palette tertiary
0
10
20
30
40
50
60
70
80
90
100
palette neutral
0
10
20
30
40
50
60
70
80
90
100

Basic Usage link

Loading editor...

<script>
  import { RadioStatic } from 'radio-color-system';

  let colors = [{
      color: '#0652da',
      name: ['primary', 'secondary', 'tertiary']
    },
    {
      color: '#919191',
      name: 'neutral'
    }
  ];
</script>

<RadioStatic {colors} async={true} />

<div class="primary-90 primary-90-text">
  Primary Color
</div>

<div class="secondary-50 primary-50-text">
  Secondary Color
</div>

<div class="tertiary-40 tertiary-40-text">
  Tertiary Color
</div>

Motivation

System design libraries offer a plethora of elements that can be overwhelming to navigate. However, incorporating a system change library into your project can enhance your productivity and simplify development processes. Yet, customization and optimization can be challenging to implement. Fortunately, Svelte's unique and intuitive structure eliminates the need for most component library dependencies.

With Radio Color System & Svelte, you can easily create your own color system and rapidly develop your desired components.

Advanced usage
Selected image

Content-based color palettes

RadioActive allows the end user to edit the theme according to the content they are interacting with. You can use it for content that may be irrelevant to your color palette and provide a more personalized experience.

It converts the color values in the current image to hsl format and groups them. Uses the dominant one of these colors, and expects the colors to be between a certain light and saturation value.

If the image is not suitable for the algorithm, it will return the default color. More information about the exceptions; CanvasRenderingContext2D: getImageData()

Inactive imageInactive image
point_scan

Works independently of any design system and it has a single purpose.

deployed_code

Allows you to work asynchronously and gain from the colors that will come pre-loaded in your project.

Usage of content-based color palettes link

Loading editor...

<script>
 import { RadioActive } from 'radio-color-system';
</script>

<RadioActive>
	<img src="./image.jpg" alt="Rick Astley dancing" />
	<div class="card dynamic-90 dynamic-90-text">
		<h3>Dynamic Color</h3>
		<p>Dynamic colors are great</p>
	</div>
</RadioActive>

<style>
.card {
	padding: 1rem;
	border-radius: 0.5rem;
	margin-bottom: 1rem;
} 
</style>
Advanced usage

RadioActive link

async link

check_box boolean
Optional

By default this value is false, when the image loaded after than generates the color. If you want to dont use default color set this value to true.

Default "false"

target link

format_quote string
Optional

It adds an id attribute to the element it is used in and creates the styles to be created under this id. In cases where it is used in more than one place on the page, it is necessary to give a unique value.

Default "dynamic"

color

data_object ColorOption
Optional

It adds an id attribute to the element it is used in and creates the styles to be created under this id. In cases where it is used in more than one place on the page, it is necessary to give a unique value.


RadioStatic link

async link

check_box boolean
Optional

When true, the component will be rendered asynchronously. This is useful for optimizing performance when the component is rendered in a loop. Also be careful when using this, cause of async color load user can see a flash of unstyled content.

Default "false"

colors

data_array ColorOption[]

The options for generating color variants

Default "[]"

target link

format_quote string
Optional
Default ":root"

ColorVariant link

ColorVariant() link

function function

A function that returns an array of objects representing the color variant. The returned objects should have the `count`, `background`, and `foreground` properties.


color

data_object Color

The color to use for the variant.


ColorOption link

The base color to use for generating the color variants. You can use Color type or a string in the format of rgb or hex.


prefix link

format_quote string
Optional

A prefix to use when generating token names.


name link

format_quote string
Optional

A name to use when generating token names.


suffix link

format_quote string
Optional

A suffix to use when generating token names.


dark link

check_box boolean
Optional

Whether to generate dark color variants.


font link

check_box boolean
Optional

Whether to generate font color variants.


selector link

data_object object
Optional

An object specifying which selectors to generate.


check_box boolean
Optional

Whether to generate attribute selectors.


check_box boolean
Optional

Whether to generate class selectors.


theme link

data_object object
Optional

An object specifying color variants to use when generating token styles.


darken

function ColorVariant
Optional

A function that returns an array of objects representing dark color variants.


lighten

function ColorVariant
Optional

A function that returns an array of objects representing light color variants.


Color link

h link

123 number

The hue value of the color (0-360)


s link

123 number

The saturation value of the color (0-100)


l link

123 number

The lightness value of the color (0-100)