Open links in new tab
    • Work Report
    • Email
    • Rewrite
    • Speech
    • Title Generator
    • Smart Reply
    • Poem
    • Essay
    • Joke
    • Instagram Post
    • X Post
    • Facebook Post
    • Story
    • Cover Letter
    • Resume
    • Job Description
    • Recommendation Letter
    • Resignation Letter
    • Invitation Letter
    • Greeting Message
    • Try more templates
  1. In JavaScript, you can set the color of an element using the style.color property. This property allows you to change the text color of an HTML element.

    Example

    document.getElementById("myElement").style.color = "blue";
    Copied!

    This will change the text color of the element with the ID myElement to blue.

    Setting Colors

    You can set colors using various formats such as:

    1. Named Colors: e.g., "red", "blue", "green".

    2. Hexadecimal Colors: e.g., "#FF0000" for red.

    3. RGB Colors: e.g., "rgb(255, 0, 0)" for red.

    4. RGBA Colors: e.g., "rgba(255, 0, 0, 0.5)" for red with 50% opacity.

    Example

    document.getElementById("myElement").style.color = "#FF0000"; // Hexadecimal
    document.getElementById("myElement").style.color = "rgb(255, 0, 0)"; // RGB
    document.getElementById("myElement").style.color = "rgba(255, 0, 0, 0.5)"; // RGBA
    Copied!

    Browser Support

    The color property is supported in all modern browsers.

    List of Named Colors

    Feedback
  2. Color Names - JavaScripter.net

    Question: What color names are supported by JavaScript? Newer browsers support many more color names (see an alphabetical list below). You can try all these colors here:

  3. Javascript Color Picker

    An open source, free (as in beer), versatile, flexible and lightweight Javascript Color Picker Component supporting light and dark skins, swatches, multiple color formats, CSS color parsing, instant and …

  4. javascript - Get color name by HEX or RGB - Stack …

    How can I get a color name using JS/JQuery, knowing the code RBG/HEX? For …

    • Reviews: 2

      Code sample

      window.classifier = new ColorClassifier();
      get_dataset('dataset.js', function (data){
        window.classifier.learn(data);
      });
      var result_name = window.classifier.classify("#aaf000");
    • jscolor: JavaScript Color picker with Opacity (alpha channel)

      Highly customizable jscolor provides variety of configuration options. Whether you need to change color picker's size or colors, or attach a function to its onchange event, the configuration can be fine-tuned …

    • Coloris | Elegant JavaScript Color Picker

      A lightweight and elegant JavaScript color picker written in vanilla ES6. Zero dependencies, customizable, and fully accessible.

    • JavaScript: Color Values - w3resource

      141 rows · Aug 19, 2022 · The colors defined in the following table are used in the JavaScript alinkColor, bgColor, fgColor, linkColor, and vLinkColor properties and the fontcolor method.

    • Colors in JavaScript - 30 seconds of code

      Feb 2, 2024 · Learn how to generate a random hexadecimal color code with a few lines of JavaScript. How can I convert between hexadecimal, RGB, HSL and HSB …

    • JavaScript Color Library: An Introductory Guide

      Aug 21, 2023 · In this article, you will find out why you need a color JavaScript library, why color is the best one, and what features and methods it offers. Let’s …

    • Color Hex - ColorHexa.com

      Colors by name ColorHexa.com is a free color tool providing information about any color and generating matching color palettes for your designs (such as …