Git Product home page Git Product logo

color-palette-wc's Introduction

Colour Palette

This Web Component is used to showcase a collection of colours.

It also shows the contrast rating with black and white text, and shows the accessibility rating according to WCAG's Contrast (Enhanced)(Level AAA) success criterion.

This Web Component using Stencil.

Get started

npm install
npm start

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

Using this component (To be updated)

There are three strategies we recommend for using web components built with Stencil.

The first step for all three of these strategies is to publish to NPM.

Script tag

  • Put a script tag similar to this <script type='module' src='https://unpkg.com/[email protected]/dist/my-component.esm.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install my-component --save
  • Put a script tag similar to this <script type='module' src='node_modules/my-component/dist/my-component.esm.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil-starter app

  • Run npm install my-component --save
  • Add an import to the npm packages import my-component;
  • Then you can use the element anywhere in your template, JSX, html etc

color-palette-wc's People

Contributors

maxelkins avatar

Watchers

 avatar

color-palette-wc's Issues

Add descriptions/explaination

Some aspects of the component might not be clear on first inspection. Label, decriptions or explainations should be added.

  • Label black/white text tags
  • AAA vs AA contrast specs
  • ???

Add OKLCH support

Add support for OKLCH colours. Could also add support for other new colour formats.

Will want to avoid coverting to HEX as will lose the P3 colour space.

  • LCH
  • OKLCH
  • LAB
  • OKLAB

Should try to use colord plugins for this

Add contrast tooltips

When adding tooltips consider a11y. If info is not otherwise accessible, then it shouldn't be in a tooltip.

  • Contrast ratios (also accessbile via controls)

Controls - Text colours

Ability to choose what text colours you would like to check contrast against. Currently defaults to black and white.

Remove styles specific to black/white

The text colour in the row and some tag styles are currently dependant on the text (foreground) being black or white.

As the tag is now more flexibile (#18), its own styles should be too.

Publish to npm

  • Add changelog
  • Add more detail to readme
  • Publish to npm
  • Set up publishing process
  • Move to gitlab(?)

LAB contrast checking not working

Image

This is because in colord lib. It expects LAB info as a object, so you cannot pass it as a string like all the other colour fromats.

Support for more colour formats

Currently the component only support colours in hsla format.

The component should be able to take a wide range of colour formats. For MVP:

  • hex
  • hsl
  • rgb

Moved to #13

  • oklch
  • named colours?

Approach should be to find a library that can handle the conversions.

Use colord lib to simplify code

Use colord plugins to simplify code.

  • Check contrast again exisiting - Its same or lower in all cases
  • Check contrast against online checker - Checked with open props reds
  • Add support for all colord supported color formats.
  • Remove utils that are not needed
  • Seperate tag to its own component

Also done:

  • Made tag more flexibile can now take in any background/foreground colours, however some styling is still hardcoded for black/white #18

Optional controls

  • Show/hide contrast values
  • Show/hide fails
  • Show/hide passes
  • Choose WCAG spec - Moved to new issue #9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.