GithubHelp home page GithubHelp logo

xml-wizard / huetiful Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 5.0 12.72 MB

Function oriented library for color manipulation πŸ§ͺ

Home Page: http://huetiful-js.com/

License: Apache License 2.0

JavaScript 100.00%
color javascript lch color-vision-deficiency tailwindcss color-schemes data-visualization generative-art generators algorithmic-art

huetiful's Introduction

huetiful-logo

Deploy GitHub Pages NPM publish πŸ“¦ NPM Downloads GitHub Repo stars npm minzipped size twitter

huetiful-js is a small (~10kB) & fast library for color manipulation written in JavaScript.

It is function oriented and borrows a lot of its features from color theory but tries to hide away the science from the developer.

The library aims to parse colors from as many types as possible allowing freedom to define our color tokens as we see fit as well as parse colors from other source. For instance, methods such as the HTML Canvas API's getImageData() method. The collection methods try to be as generic as possible by treating ArrayLike and Map-like objects as valid color collections so long as the values are parseable color tokens.

It uses Culori under the hood which provides access to low level functions for color conversions and other necessary bells and whistles that this library depends on. It works both in Node and the browser.

Features

Installation

Using a package manager

Note that the library is ESM and UMD only.

Assuming you already have Node already installed, you can add the package using npm/yarn or any other Node based package manager:

npm i huetiful-js

Or:

yarn add huetiful-js

In the browser and via CDNs

You can use also a CDN in this example, jsdelivr to load the library remotely:

import {...} from 'https://cdn.jsdelivr.net/npm/huetiful-js/lib/huetiful.esm.js'

Or load the library as a UMD glabal (huetiful) in your HTML file using a <script> tag:

# With script tag

<script src='https://cdn.jsdelivr.net/npm/huetiful-js/dist/huetiful.umd.js'></script>

Quickstart

See the Quickstart here

Community

See the discussions and just say hi, or share a coding meme (whatever breaks the iceπŸ”οΈ)

Contributing

This project is fully open source! Contributions of any kind are greatly appreciated! SeeπŸ” the contributing page on the documentation site file for more information on how to get started.

References

This project is a result of open source resources from many places all over the Internet.

See some of the references here

 License βš–οΈ

 Β© 2024, Dean Tarisai & xml-wizard contributors
 Released under the  Apache 2.0 license.
 πŸ§ͺ & πŸ”¬ with πŸ₯ƒ in Crowhill,ZW

huetiful's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

huetiful's Issues

Remove dependency on lodash to reduce code bloat.

For the sake of rapid prototyping, I had relied on the lodash library to provide utilities I needed to get the job done. However, as of v1.7, effort is being made to use vanilla JS for all utilities and implement the special ones myself.

So in version 1.8, I'm including a new directory fp/ that will contain all these utilities. The funcs inside will be categorised by the data types they work on. This will, also find the helpers.ts module being refactored and broken down into smaller modules for better readability

Create a nextjs based documentation site

I want to clone my blog into the docs directory. Since it already has syntax highlighting, I can refactor my docs into simple mdx files with Playground components/codepens that

Map all TailwindCSS colors too etc and the values from the functions

Improving the UX for docs

A lot of effort needs to be put into improving the overall UX of the documentation site.

Over the next month I'll be adding small but noticeable improvements to help make it easier to navigate the site. Contributions are greatly appreciated devs!!

tonalPalette function should be customizable.

The tonalPalette() utility should provide an override to adjust different variables when computing the tonal palettes. It could also output a theme Map that contains contains palette options as per Material Design Guidelines.

Migrating the docs to Docsify

For aesthetic and ease of use we're migrating the docs to Docsify because it relies on simple Markdown and allows the source files to be easily edited.

Gradient generator core function not yet defined

This function should be able to take Map and iterate over the key value pairs returning gradients which can be used as a CSS reference to the background property. Customization of the manipulation could be done through eases, the use of different color spaces and different interpolation methods.

Setting up unit tests for the library.

Currently I'm debugging using console.log πŸ˜‚ and that's a bit tedious given the amount of code I need to test. Any suggestions on how to setup a testing/assertion library would be nice.

Create a README

Add a README file to highlight the capabilities/functionalities of the library.

API and documentation needs drafting.

At the moment the project has no plausible API. Some attention to the documentation could be useful in reference during development. They could be two documentations. One which is more low level and used by contributors and another one which is more high level and is meant to be as concise as possible for anyone who wants to consume the code.

Add ESLint to the project

Adding ESLint will help maintain sanity in the codebase ensuring that the coding style is consistent. For example, since this is an open source project, there's a keen focus on readable code which means using if...else instead of ternary operators et cetera.

hueShifted palette generator function.

This utility should be able to take a collection preferably a Map that has keys to the color roles ie primary, secondary and returns a collection of hue shifted palettes. Customizable by default.

Using treeshaken Culori to reduce bundle size.

At the moment, the library is a bit bloated with code which is not used but included in the bundle anyway.

According to the Culori docs, we can use the treeshaken version which allows us to import only what we need.

What does this mean ?

This is going to mean a library wide refactoring in all modules that are importing Culori.

  1. First, color spaces won't be initialized by default. The library will be limited to CSS recognized color spaces for now.
  2. Importing individual lodash utilities (if it means smaller bundle size)
  3. Setting up ESLint to help detect unused code thus keeping our code clean.

CLI for the library to allow more flexibility in use cases.

Create a command line tool that can generate pelette maps and save them as files. Similar to generating a tailwind.config.js file. The interface could support taking in a presaved palettes.json file with the relevant key value pair meta.

Docs: add a link to the source code for each utility

What would you like to share

Add a link to the source code for each utility. Since every H4 element in the doc source files is a heading for a utility we can attach these links by dynamically attaching the heading title to a path pattern to the repository

Here's an example from the Lodash docs

As you can see above, source and npm package are links that lead to external resources. In this case, we only need to link to the source. Also, notice how the details for each component are laid out in a well-spaced manner making readability a breeze. All the utilities are documented using a uniform schema containing the fields:

  • Parameters
  • Description
  • Returns
  • Example

Maybe a React component to template this layout would be efficient.

Add Husky for precommit hooks

Some tasks are starting to get tedious and would benefit from automation

To allow us to work better can we have an ESLint and Prettier precommit hook ?

Will add more specifications later.

Docs: add a table of contents in the reading view

Add a Table of Contents Table that lists all the headings in the document. Since the source files for the docs are plain text files .mdx we could use a remark-plugin or a RegExp that maps through all headings and adds them to the TOC

setTemp crashes when you pass in an argument

So apparently setTemp has a bug that's making it crash even when invoked with the correct parameters πŸ˜‚. Obviously this is the worst bug ever and a sign of carelessness during testing.

The issue has been resolved in v1.6 and it will be released soon.

Create a dynamic landing page

So far the documentation site is a bit flat on the aesthetics side but I have few ideas in mind

  • Full sized hero background with SVG and animation
  • A detailed description of what the library can do
  • A getting started section
  • GitHub/NPM statistics
    Will update the issue it I think of anything else

Docs: add wrapping on the code blocks on small screens

Current Behaviour

The code blocks scroll horizontally on small screens.

Suggestions

It would be nice to add some wrapping and use a lighter monospace font for the code blocks (I think the font for code is a bit too heavy)

Enhancement: make homepage UX better

People like what they see so a pretty landing page is a necessary aesthetic. I think they're plenty of landing page examples out there for libraries but here's what I had in mind:

  • A flowfield coverpage that has shifting colors (kinda makes the project goal obvious that its about color). This could be preferably full viewport.
  • A description of the library capabilities, a getting started section and at the footer we can put some statistics about the project e.g stargazers, forks and contributors.

Screenshot_20231103_124108_com.sec.android.app.sbrowser.jpg

I've attached an example landing page above. Feel free to make suggestions

Improving the UX for docs

Discussed in #62

Originally posted by prjctimg October 24, 2023
A lot of effort needs to be put into improving the overall UX of the documentation site.

Over the next month we'll be adding small but noticeable improvements to help make it easier to navigate the site. Contributions are greatly appreciated devs!!

Improvements

Homepage

Reading View

List View

Start a knowledge base on color

Colour is a broad subject and I've noticed that for most people they can't use the library because of lack of background information on the terminologies used in colour science.

By v1.8 the docs will have a knowledge base section that has short and concise introductions to terminologies used when we are working with color.

Use of TypeScript for a streamlined development experience.

UpThis could help eliminate ambiguity and potential bugs by programming to agreed upon interfaces which will also make it easy to extend the functions. Please feel free to offer criticism if JavaScript would be your preference since I am not proficient in the superset myself. If possible recommendations for setting up the TypeScript development environment with minimal maintenance and a more focus on designing functionality, would be greatly appreciated.

Docs: add edit in Github button on each page

What would you like to share

Add an edit in GitHub button on every page so that it's easy to fix typos and adjust the docs. A 'was this doc' useful statistic would also help us better our documentation, but of course, it's a 'nice to have' feature.

Here's an example from the MUI docs:

Demonstrations and examples for using the library.

Concise yet fully explanatory demos or examples of using the library's utilities are necessary to ensure a lower learning curve for our potential code users. This can involve following guidelines that cover all relevant meta about the code being demonstrated its use cases.

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.