Giter Site home page Giter Site logo

cli-css's Introduction

cli-css

Convert colors using the command line.

Create a function that converts from hex colors to rgb colors.

(just copy and paste the answer from this stackoverflow question)

https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb

Write a nodejs command line program that takes a hex color as an argument and returns the rbg CSS value.

$ node index.js hex \#ffffff

Will print out:

rgb( 255, 255, 255 )

Getting started

Create an index.js file. Run it with node index.js.

Further

Create the functionality to put in 3 number values and get out the hex color.

Change the program to take the kind of conversion you want to do.

node index.js rgb 255 255 255

Will print out:

#ffffff

Further

Separate your conversion functions out into separate module file(s).

Further

Add HSL colors.

If the user puts in a hex color, print out the rgb and hsl values.

If the user puts in a rgb value, print out the hsl an d hex values.

Further

Color the output using bash colors: (note this doesn't work on all terminals!)

// set as red
var r = 255;
var b = 0;
var g = 0;

// this special console will create colored output
console.log(`\x1b[38;2;${r};${g};${b}m%s\x1b[0m`, myOutput);

Further

Using some UNIX CLI syntax to be able to take in a number of colors and print out a conversion for each input.

This example gives the result of cat to your program.

node index.js hex $(cat colors.txt)

Further

Give your program the ability to calculate more information about colors.

Output other color harmonies given an input: https://dev.to/benjaminadk/make-color-math-great-again--45of

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.