Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hex-to-rgb-jquery

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hex-to-rgb-jquery

Unit testing helper function that converts hex colors to rgb colors

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

hex-to-rgb-jquery

Unit testing helper function that converts hex colors to rgb colors

license npm Travis Dependency Status devDependency Status

What is hex-to-rgb-jquery?

hex-to-rgb-jquery is a wrapper for onecolor that adjusts its response so it matches the rgb format jQuery returns.

Install

$ npm install hex-to-rgb-jquery --save-dev

Usage

Add the following script tag to your unit test runner.

<script src="../node_modules/hex-to-rgb-jquery/dist/hex-to-rgb.js"></script>

Example

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Test Runner</title>
    <link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
    <!-- lib scripts -->
    <script src="../node_modules/mocha/mocha.js"></script>
    <script src="../node_modules/chai/chai.js"></script>

    <!-- hex-to-rgb script -->
    <script src="../node_modules/hex-to-rgb-jquery/dist/hex-to-rgb.js"></script>

    <!-- Mocha setup -->
    <script type="text/javascript">
      chai.should();
      mocha.setup('bdd');
      // Start the suite.
      window.onload = function() {
        mocha.run();
      };
    </script>
  </head>
  <body>
    <div id="mocha"></div>
    <div id="fixture"></div>

    <!-- source code scripts -->

    <!-- test scripts -->
  </body>
</html>

Call the function in the test

window.hexToRgbJquery.hexToRgb('#fff');

Ex in context of a test:

var hexToRgb = window.hexToRgbJquery.hexToRgb;

describe('hex-to-rgb tests', function() {
  context('when a hex value is passed', function() {
    it('with all six characters a valid corresponding rgb value should be returned', function() {
      hexToRgb('#f1f1f1').should.equal('rgb(241, 241, 241)');
    });
  });
});

Contributing

Please see CONTRIBUTING.md.

Release History

Please see CHANGELOG.md.

License

Copyright (c) 2017 Thomas Lindner. Licensed under the MIT license.

Keywords

FAQs

Package last updated on 28 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc