Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xanderfrangos/windows-accent-colors
Node.js module to get user accent colors, including the derivative colors used by the Windows UI. (Windows 10+)
https://github.com/xanderfrangos/windows-accent-colors
accent-color colors electron node nodejs windows windows-10 windows-11
Last synced: about 4 hours ago
JSON representation
Node.js module to get user accent colors, including the derivative colors used by the Windows UI. (Windows 10+)
- Host: GitHub
- URL: https://github.com/xanderfrangos/windows-accent-colors
- Owner: xanderfrangos
- License: mit
- Created: 2021-12-30T00:39:53.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-15T03:53:31.000Z (10 months ago)
- Last Synced: 2024-03-15T04:12:31.263Z (8 months ago)
- Topics: accent-color, colors, electron, node, nodejs, windows, windows-10, windows-11
- Language: C++
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# windows-accent-colors
Node.js module for accessing the accent colors in Windows (via WinRT). This is intended as a supplement to [Electron's](https://electronjs.org/) own accent color detection. While Electron's accent color is the correct, user-selected color, it is not always the color used throughout Windows. This module provides Node.js/Electron developers with the derivative accent colors used throughout the Windows 10/11 UI. These colors are identical to the ones available via WinRT ([see Microsoft's documentation](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.ViewManagement.UIColorType?view=winrt-22000)).
## Installation
```cmd
npm i windows-accent-colors
```## Usage
Import the module and use `getAccentColors()`. For example:
```js
const AccentColors = require("windows-accent-colors");
const colors = AccentColors.getAccentColors();
console.log(`The color of sliders in Windows 11 is: ${colors.accentLight2.hex}`);
```The function `getAccentColors()` will return an object of all derivative accent colors in RGB and Hex format. For example:
```json
{
"accent": { "r": 232, "g": 17, "b": 35, "hex": "#e81123" },
"accentDark1": { "r": 210, "g": 14, "b": 30, "hex": "#d20e1e" },
"accentDark2": { "r": 158, "g": 9, "b": 18, "hex": "#9e0912" },
"accentDark3": { "r": 111, "g": 3, "b": 6, "hex": "#6f0306" },
"accentLight1": { "r": 239, "g": 39, "b": 51, "hex": "#ef2733" },
"accentLight2": { "r": 244, "g": 103, "b": 98, "hex": "#f46762" },
"accentLight3": { "r": 251, "g": 157, "b": 139, "hex": "#fb9d8b" },
"background": { "r": 0, "g": 0, "b": 0, "hex": "#000000" },
"foreground": { "r": 255, "g": 255, "b": 255, "hex": "#ffffff" }
}
```