npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lumi-control

v1.3.8

Published

Programmatically adjust the brightness level of connected monitors.

Downloads

17

Readme

☀️ Lumi

npm version

Lumi is a Node.js module that allows you to adjust the brightness of your internal or external monitors.

Installation

Install via npm:

npm install lumi-control

Usage

const lumi = require('lumi-control');

// Get a list of available monitors
const monitors = lumi.monitors();

// Get the current brightness of the primary monitor
const {success, brightness} = await lumi.get();

// Get the current brightness of a specific monitor
const {success, brightness} = await lumi.get(monitorId);

// Set the brightness of the primary monitor to 50%
const {success, message} = await lumi.set(50);

// Set a specific monitor's brightness to 50%
const {success, message} = await lumi.set(monitorId, 50);

// Set the brightness for multiple monitors
const config = {
    [firstMonitorId]: 75,
    [secondMonitorId]: 100,
    [thirdMonitorId]: 25
}
const {success, message} = await lumi.set(config);

// Set the global brightness level to 50%
const {success, message} = await lumi.set(lumi.GLOBAL, 50);

API

lumi.get()

Attempts to get the current brightness level of the primary monitor.

Returns: A Promise that resolves to a GetBrightnessResult object.

lumi.get(monitorId: string)

Attempts to get the brightness level of a specific monitor identified by monitorId.

  • monitorId: The ID of the monitor to retrieve the brightness level for.

Returns: A Promise that resolves to a GetBrightnessResult object.

lumi.set(brightness: number)

Attempts to set the brightness level of the primary monitor.

  • brightness: The brightness level to set.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.set(config: BrightnessConfiguration)

Sets the brightness levels for different monitors.

  • config: An object that maps monitor IDs to brightness levels.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.set(monitorId: string | ALL_MONITORS, brightness: number)

Attempts to set the brightness level of a specific monitor by id or, if provided the GLOBAL constant, the global brightness level.

  • monitorId: The ID of the monitor to set the brightness level for.
  • brightness: The brightness level to set.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.monitors()

Returns an array of available monitors.

Returns: An array of Monitor objects.

Types

BrightnessConfiguration

An object that maps monitor IDs to brightness levels.

Monitor

Represents a monitor.

  • id: The unique ID of the monitor.
  • name: The name of the monitor.
  • manufacturer: The manufacturer of the monitor.
  • serialNumber: The serial number of the monitor.
  • productCode: The product code of the monitor.
  • internal: Indicates whether the monitor is an internal display.
  • position: Monitor coordinates in pixels (x, y)
  • size: Monitor size in pixels (width, height)

GetBrightnessResult

The result of a get brightness operation.

  • success: Indicates whether the operation was successful.
  • brightness: The retrieved brightness level. It is null when success is false.

SetBrightnessResult

The result of a set brightness operation.

  • success: Indicates whether the operation was successful.
  • message: An error message when success is false, otherwise null.