Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. rgb2hex ![Test Changes](https://github.com/christian-bromann/rgb2hex/workflows/Test%20Changes/badge.svg) [![Known Vulnerabilities](https://snyk.io/test/github/christian-bromann/rgb2hex/badge.svg?targetFile=package.json)](https://snyk.io/test/github/christian-bromann/rgb2hex?targetFile=package.json)
  2. =======
  3. Parse any rgb or rgba string into a hex color. Lightweight library, no dependencies!
  4. ## Installation
  5. via NPM:
  6. ```
  7. $ npm install rgb2hex
  8. ```
  9. via Bower
  10. ```
  11. $ bower install rgb2hex
  12. ```
  13. ## Usage
  14. Include `rgb2hex.js` in your web app, by loading it as usual:
  15. ```html
  16. <script src="rgb2hex.js"></script>
  17. ```
  18. ### Using NodeJS
  19. ```js
  20. var rgb2hex = require('rgb2hex');
  21. console.log(rgb2hex('rgb(210,43,2525)'));
  22. /**
  23. * returns:
  24. * {
  25. * hex: '#d22bff',
  26. * alpha: 1
  27. * }
  28. */
  29. console.log(rgb2hex('rgba(12,173,22,.67)'));
  30. /**
  31. * returns:
  32. * {
  33. * hex: '#d22bff',
  34. * alpha: 0.67
  35. * }
  36. */
  37. ```
  38. ### Using RequireJS
  39. rgb2hex can be also loaded with AMD:
  40. ```js
  41. require(['rgb2hex'], function (rgb2hex) {
  42. // ...
  43. });
  44. ```
  45. ## Contributing
  46. Please fork, add specs, and send pull requests! In lieu of a formal styleguide, take care to
  47. maintain the existing coding style.
  48. ## Release History
  49. * 2013-04-22   v0.1.0   first working version
  50. * 2018-05-24   v0.1.1   updated dependencies switch test framework to jest
  51. * 2018-06-13   v0.1.2   Fixes uncontrolled resource consumption vulnerability referenced in #1. ([ref1](https://nodesecurity.io/advisories/647), [ref2](https://snyk.io/vuln/npm:rgb2hex:20180429))
  52. * 2018-06-13   v0.1.3   allow semicolon at the end of an rgb string
  53. * 2018-06-19   v0.1.4   ignore text before or after the color
  54. * 2018-07-04   v0.1.5   Fix stripping of color and regexp
  55. * 2018-07-05   v0.1.6   Prevent Regular Expression Denial of Service attacks
  56. * 2018-07-05   v0.1.7   Minor coverage fix
  57. * 2018-07-05   v0.1.8   Better handle alpha values
  58. * 2018-07-18   v0.1.9   Support transparent colors
  59. * 2019-11-11   v0.1.10  Support multiple decimal places [(#20)](https://github.com/christian-bromann/rgb2hex/pull/20)
  60. * 2020-11-24   v0.2.1   TypeScript support
  61. * 2020-11-25   v0.2.2   Improved TypeScript support