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

css-prefers-color-scheme

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-prefers-color-scheme - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

5

CHANGELOG.md
# Changes to Prefers Color Scheme
### 7.0.1 (August 23, 2022)
- Fix: assign global browser polyfill to `window`, `self` or a blank object.
### 7.0.0 (July 8, 2022)

@@ -17,3 +21,2 @@

##### If you use a CDN url, please update it.

@@ -20,0 +23,0 @@

2

dist/browser-global.js

@@ -1,2 +0,2 @@

!function(){var e=/prefers-color-scheme:/i;self.prefersColorSchemeInit=function(t,a){a||(a={}),a={debug:!!a.debug||!1};var r="(prefers-color-scheme: dark)",i="matchMedia"in window&&window.matchMedia(r),c=i&&i.media===r,o=function(){n(i&&i.matches?"dark":"light")},n=function(t){"dark"!==t&&"light"!==t&&(t=c&&i.matches?"dark":"light"),t!==l&&(l=t,"function"==typeof d.onChange&&d.onChange()),[].forEach.call(document.styleSheets||[],(function(r){try{var i=[];[].forEach.call(r.cssRules||[],(function(e){i.push(e)})),i.forEach((function(a){if(e.test(Object(a.media).mediaText)){var r=[].indexOf.call(a.parentStyleSheet.cssRules,a);a.parentStyleSheet.deleteRule(r)}else{var i=(Object(a.media).mediaText||"").match(/\( *(?:color|max-color): *(48842621|70318723) *\)/i);i&&i.length>1&&("dark"===t&&"48842621"===i[1]?a.media.mediaText=a.media.mediaText.replace(/\( *color: *(?:48842621) *\)/i,"(max-color: "+i[1]+")"):"light"===t&&"70318723"===i[1]?a.media.mediaText=a.media.mediaText.replace(/\( *color: *(?:70318723) *\)/i,"(max-color: "+i[1]+")"):a.media.mediaText=a.media.mediaText.replace(/\( *max-color: *(?:48842621|70318723) *\)/i,"(color: "+i[1]+")"))}}))}catch(e){a.debug&&console.error(e)}}))},d=Object.defineProperty({hasNativeSupport:c,removeListener:function(){i&&i.removeListener(o)}},"scheme",{get:function(){return l},set:n}),l=t||(i&&i.matches?"dark":"light");return n(l),i&&("addEventListener"in i?i.addEventListener("change",o):i.addListener(o)),d}}();
!function(){var e=/prefers-color-scheme:/i,t=function(t,a){a||(a={}),a={debug:!!a.debug||!1};var i="(prefers-color-scheme: dark)",o="matchMedia"in window&&window.matchMedia(i),r=o&&o.media===i,c=function(){n(o&&o.matches?"dark":"light")},n=function(t){"dark"!==t&&"light"!==t&&(t=r&&o.matches?"dark":"light"),t!==l&&(l=t,"function"==typeof d.onChange&&d.onChange()),[].forEach.call(document.styleSheets||[],(function(i){try{var o=[];[].forEach.call(i.cssRules||[],(function(e){o.push(e)})),o.forEach((function(a){if(e.test(Object(a.media).mediaText)){var i=[].indexOf.call(a.parentStyleSheet.cssRules,a);a.parentStyleSheet.deleteRule(i)}else{var o=(Object(a.media).mediaText||"").match(/\( *(?:color|max-color): *(48842621|70318723) *\)/i);o&&o.length>1&&("dark"===t&&"48842621"===o[1]?a.media.mediaText=a.media.mediaText.replace(/\( *color: *(?:48842621) *\)/i,"(max-color: "+o[1]+")"):"light"===t&&"70318723"===o[1]?a.media.mediaText=a.media.mediaText.replace(/\( *color: *(?:70318723) *\)/i,"(max-color: "+o[1]+")"):a.media.mediaText=a.media.mediaText.replace(/\( *max-color: *(?:48842621|70318723) *\)/i,"(color: "+o[1]+")"))}}))}catch(e){a.debug&&console.error(e)}}))},d=Object.defineProperty({hasNativeSupport:r,removeListener:function(){o&&o.removeListener(c)}},"scheme",{get:function(){return l},set:n}),l=t||(o&&o.matches?"dark":"light");return n(l),o&&("addEventListener"in o?o.addEventListener("change",c):o.addListener(c)),d};("object"==typeof window&&window||"object"==typeof self&&self||{}).prefersColorSchemeInit=t}();
//# sourceMappingURL=browser-global.js.map
{
"name": "css-prefers-color-scheme",
"description": "Use light and dark color schemes in all browsers",
"version": "7.0.0",
"version": "7.0.1",
"contributors": [

@@ -56,3 +56,3 @@ {

"devDependencies": {
"puppeteer": "^15.1.1"
"puppeteer": "^16.0.0"
},

@@ -59,0 +59,0 @@ "scripts": {

@@ -136,7 +136,7 @@ # Prefers Color Scheme [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]

<!-- When using a CDN url you will have to manually update the version number -->
<script src="https://unpkg.com/css-prefers-color-scheme@6.0.3/dist/browser-global.js"></script>
<script src="https://unpkg.com/css-prefers-color-scheme@7.0.1/dist/browser-global.js"></script>
<script>prefersColorSchemeInit()</script>
```
⚠️ Please use a versioned url, like this : `https://unpkg.com/css-prefers-color-scheme@6.0.3/dist/browser-global.js`
⚠️ Please use a versioned url, like this : `https://unpkg.com/css-prefers-color-scheme@7.0.1/dist/browser-global.js`
Without the version, you might unexpectedly get a new major version of the library with breaking changes.

@@ -215,3 +215,3 @@

```html
<script src="https://unpkg.com/css-prefers-color-scheme@6.0.3/dist/browser-global.js"></script>
<script src="https://unpkg.com/css-prefers-color-scheme@7.0.1/dist/browser-global.js"></script>
<script>prefersColorSchemeInit('light', { debug: true })</script>

@@ -218,0 +218,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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