daily-color 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0](https://github.com/aimeerivers/daily-color/compare/v1.3.1...v2.0.0) (2024-11-09)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * Importing with `require` will no longer work. Instead use `import { getDailyColor } from "daily-color";`
9
+
10
+ ### Features
11
+
12
+ * Convert to ES module ([#15](https://github.com/aimeerivers/daily-color/issues/15)) ([0444973](https://github.com/aimeerivers/daily-color/commit/04449739647216ddda101b5fdd4b3c7be2e0a662))
13
+
14
+ ## [1.3.1](https://github.com/aimeerivers/daily-color/compare/v1.3.0...v1.3.1) (2024-11-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Make the text stand out slightly better on the demo page ([#13](https://github.com/aimeerivers/daily-color/issues/13)) ([f1a61bc](https://github.com/aimeerivers/daily-color/commit/f1a61bcadb0cab38d89a152b2886226e7c8e53cd))
20
+
3
21
  ## [1.3.0](https://github.com/aimeerivers/daily-color/compare/v1.2.0...v1.3.0) (2024-11-09)
4
22
 
5
23
 
package/README.md CHANGED
@@ -4,6 +4,8 @@ Provides a unique hex code each day
4
4
 
5
5
  ## Install
6
6
 
7
+ Install from [npmjs.com/package/daily-color](https://www.npmjs.com/package/daily-color):
8
+
7
9
  ```bash
8
10
  npm install daily-color
9
11
  ```
@@ -13,7 +15,7 @@ npm install daily-color
13
15
  In a JavaScript/TypeScript project, using NPM:
14
16
 
15
17
  ```javascript
16
- const getDailyColor = require("daily-color");
18
+ import { getDailyColor } from "daily-color";
17
19
 
18
20
  console.log("Today's color is:", getDailyColor());
19
21
  ```
@@ -21,8 +23,9 @@ console.log("Today's color is:", getDailyColor());
21
23
  Directly loading the bundled JavaScript, for static projects not using NPM:
22
24
 
23
25
  ```html
24
- <script src="https://www.aimeerivers.com/daily-color/dist/daily-color.js"></script>
25
- <script>
26
+ <script type="module">
27
+ import { getDailyColor } from "https://www.aimeerivers.com/daily-color/dist/daily-color.js";
28
+
26
29
  console.log("Today's color is:", getDailyColor());
27
30
  </script>
28
31
  ```
@@ -33,6 +36,10 @@ Using the CLI:
33
36
  dailycolor
34
37
  ```
35
38
 
39
+ Just want to see today's color?
40
+
41
+ There is a demo on [www.aimeerivers.com/daily-color](https://www.aimeerivers.com/daily-color/)
42
+
36
43
  ## Development
37
44
 
38
45
  Install dependencies:
package/bin/dailycolor.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const getDailyColor = require("../index");
3
+ import { getDailyColor } from "../index.js";
4
4
 
5
5
  console.log(getDailyColor());
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.getDailyColor=e():t.getDailyColor=e()}(self,(()=>{return t={237:t=>{t.exports=function(){const t=function(t){const e=t.getDate(),o=t.getMonth()+1,r=`${t.getFullYear()}-${o}-${e}`;let n=0;for(let t=0;t<r.length;t++)n=(n<<5)-n+r.charCodeAt(t),n|=0;return Math.abs(n)}(new Date),e=t>>8&255,o=255&t;return`#${(t>>16&255).toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}}},e={},function o(r){var n=e[r];if(void 0!==n)return n.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,o),a.exports}(237);var t,e}));
1
+ var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function r(){const t=function(t){const e=t.getDate(),r=t.getMonth()+1,o=`${t.getFullYear()}-${r}-${e}`;let a=0;for(let t=0;t<o.length;t++)a=(a<<5)-a+o.charCodeAt(t),a|=0;return Math.abs(a)}(new Date),e=t>>8&255,r=255&t;return`#${(t>>16&255).toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}t.d(e,{x:()=>r});var o=e.x;export{o as getDailyColor};
package/index.html CHANGED
@@ -20,18 +20,19 @@
20
20
  text-align: center;
21
21
  }
22
22
  #color.light {
23
- text-shadow: 0 0 0.4em rgba(0, 0, 0, 0.4);
23
+ text-shadow: 0 0 0.4em rgba(0, 0, 0, 0.5);
24
24
  }
25
25
  #color.dark {
26
- text-shadow: 0 0 0.4em rgba(255, 255, 255, 0.4);
26
+ text-shadow: 0 0 0.4em rgba(255, 255, 255, 0.5);
27
27
  }
28
28
  </style>
29
29
  </head>
30
30
 
31
31
  <body>
32
32
  <div id="color"></div>
33
- <script src="https://www.aimeerivers.com/daily-color/dist/daily-color.js"></script>
34
- <script>
33
+ <script type="module">
34
+ import { getDailyColor } from "https://www.aimeerivers.com/daily-color/dist/daily-color.js";
35
+
35
36
  const color = getDailyColor();
36
37
  const colorDiv = document.getElementById("color");
37
38
  document.body.style.backgroundColor = color;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function getDailyColor() {
1
+ export function getDailyColor() {
2
2
  const date = new Date();
3
3
  const hash = getSimpleHash(date);
4
4
 
@@ -25,5 +25,3 @@ function getSimpleHash(date) {
25
25
 
26
26
  return Math.abs(hash);
27
27
  }
28
-
29
- module.exports = getDailyColor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daily-color",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Provides a unique hex code each day",
5
5
  "keywords": [
6
6
  "color",
@@ -23,6 +23,7 @@
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/aimeerivers/daily-color.git"
25
25
  },
26
+ "type": "module",
26
27
  "scripts": {
27
28
  "format": "prettier --write .",
28
29
  "format:check": "prettier --check .",
package/webpack.config.js CHANGED
@@ -1,12 +1,20 @@
1
- const path = require("path");
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
2
3
 
3
- module.exports = {
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+
7
+ export default {
4
8
  entry: "./index.js",
5
9
  output: {
6
10
  path: path.resolve(__dirname, "dist"),
7
11
  filename: "daily-color.js",
8
- library: "getDailyColor",
9
- libraryTarget: "umd",
12
+ library: {
13
+ type: "module",
14
+ },
15
+ },
16
+ experiments: {
17
+ outputModule: true,
10
18
  },
11
19
  mode: "production",
12
20
  };