Skip to content

Commit

Permalink
fix: useBrightness max value
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoim committed Dec 20, 2023
1 parent 55943ca commit 98f422b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reactive_home/src/lib/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { computed, unref } from "../dep.ts";

export type UseBrightnessOptions = {
/**
* A value between 0 and 255
* A value between 0 and 254
*/
minBrigthness?: number;
/**
* A value between 0 and 255
* A value between 0 and 254
*/
maxBrigthness?: number;
};
Expand All @@ -26,7 +26,7 @@ export function useBrightness(

const opt = unref(options);

const maxBrigthness = opt.maxBrigthness ?? 255;
const maxBrigthness = opt.maxBrigthness ?? 254;
const minBrightness = opt.minBrigthness ?? 51;

if (sunPercent > 0) {
Expand All @@ -38,7 +38,7 @@ export function useBrightness(
const percent = 1 + sunPercent;

return Math.trunc(
((deltaBrightness / 255) * percent + minBrightness / 255) * 255
((deltaBrightness / 254) * percent + minBrightness / 254) * 254
);
});
}

0 comments on commit 98f422b

Please sign in to comment.