Installations
npm install validate.io-color-hexadecimal
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
0.12.7
NPM Version
2.8.3
Score
64.6
Supply Chain
95.1
Quality
74.8
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (64.35%)
Makefile (35.65%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
validate-io
Download Statistics
Total Downloads
6,503
Last Day
1
Last Week
5
Last Month
23
Last Year
291
GitHub Statistics
1 Stars
4 Commits
2 Watching
1 Branches
2 Contributors
Bundle Size
703.00 B
Minified
380.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
validate.io-color-hexadecimal@1.0.0
Size
2.75 kB
NPM Version
2.8.3
Node Version
0.12.7
Total Downloads
Cumulative downloads
Total Downloads
6,503
Last day
0%
1
Compared to previous day
Last week
66.7%
5
Compared to previous week
Last month
-51.1%
23
Compared to previous month
Last year
-14.9%
291
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
6
Hexadecimal Color
Validates if a value is a hexadecimal color.
Installation
1$ npm install validate.io-color-hexadecimal
For use in the browser, use browserify.
Usage
1var isHexColor = require( 'validate.io-color-hexadecimal' );
isHexColor( value[, mode] )
Validates if a value is a hexadecimal color.
1var bool = isHexColor( 'ffffff' ); 2// returns true
To validate for shorthand, full, or either shorthand or full hexadecimal colors, set the mode
option.
- full: (default) validate for a 6-digit hexadecimal color.
- shorthand: validate for a shorthand (3-digit) hexadecimal color.
- either: validate for either shorthand or full length hexadecimal colors.
1var bool; 2 3// Full length colors... 4bool = isHexColor( 'ffffff', 'full' ); 5// returns true 6 7bool = isHexColor( 'fff', 'full' ); 8// returns false 9 10 11// Shorthand colors... 12bool = isHexColor( 'ffffff', 'shorthand' ); 13// returns false 14 15bool = isHexColor( 'fff', 'shorthand' ); 16// returns true 17 18 19// Either shorthand or full length colors... 20bool = isHexColor( 'ffffff', 'either' ); 21// returns true 22 23bool = isHexColor( 'fff', 'either' ); 24// returns true
Examples
1var isHexColor = require( 'validate.io-color-hexadecimal' ); 2 3console.log( isHexColor( 'ffffff' ) ); 4// returns true 5 6console.log( isHexColor( '000000' ) ); 7// returns true 8 9console.log( isHexColor( 'e0e0e0' ) ); 10// returns true 11 12console.log( isHexColor( 'E0F44A' ) ); 13// returns true 14 15console.log( isHexColor( 'E0f44B' ) ); 16// returns true 17 18console.log( isHexColor( 'FFF' ) ); 19// returns false 20 21console.log( isHexColor( 'FFFFFF', 'shorthand' ) ); 22// returns false 23 24console.log( isHexColor( 'FFF', 'shorthand' ) ); 25// returns true 26 27console.log( isHexColor( 'FFFFFF', 'either' ) ); 28// returns true 29 30console.log( isHexColor( 'fff', 'either' ) ); 31// returns true 32 33console.log( isHexColor( '#ffffff' ) ); 34// returns false
To run the example code from the top-level application directory,
1$ node ./examples/index.js
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
1$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
1$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
1$ make view-cov
License
Copyright
Copyright © 2015. Athan Reines.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/4 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More