Open In App

D3.js | color.displayable() Function

Last Updated : 12 Jul, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The color.displayable() function in D3.js is used to return true if the color is displayable otherwise false. Syntax:
color.displayable()
Parameters: This function does not accept any parameters. Return Value: This function returns true if the color is displayable otherwise false. Below program illustrate the color.displayable() function in D3.js: Example: javascript
<!DOCTYPE html>
<html>

<head>
    <title>
      color.displayable() function
  </title>

    <script src=
'https://d3js.org/d3.v4.min.js'>
  </script>
</head>

<body>
    <script>
        // Calling the d3.color() function
        // with some parameters
        var color1 = d3.color("red");
        var color2 = d3.color("green");
        var color3 = d3.color("blue");

        // Calling the color.displayable() function
        var A = color1.displayable();
        var B = color2.displayable();
        var C = color3.displayable();

        // Getting the value true or false
        console.log(A);
        console.log(B);
        console.log(C);
    </script>
</body>

</html>
Output:
true
true
true
Ref: https://devdocs.io/d3~5/d3-color#color_displayable

Next Article

Similar Reads