Skip to content

Commit

Permalink
more RGB stuff aaaaaa
Browse files Browse the repository at this point in the history
  • Loading branch information
DexrnZacAttack committed Oct 10, 2024
1 parent 5caee51 commit dfe8ebd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binaryio.js",
"version": "1.2.3",
"version": "1.2.4",
"description": "BinaryIO for Node and Web environments, allows for reading/writing data like a DataView but with built in position tracking.",
"type": "module",
"main": "./dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/bWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { bCommons } from "./bCommons.js";
import { bTypes } from './bExtra.js';
import { RGBColor, RGBFormat } from "./types/RGBA.js";
import { RGBA, RGBColor, RGBFormat } from "./types/RGBA.js";

export class bWriter extends bCommons {
/** Creates an endianness-aware binary writer with built-in position tracking
Expand Down Expand Up @@ -639,7 +639,7 @@ export class bWriter extends bCommons {
this.writeByte(0);
}

public writeRGB(rgb: RGBColor, format: RGBFormat) {
public writeRGB(rgb: RGBColor | RGBA, format: RGBFormat) {
if (rgb.alpha == undefined)
rgb.alpha = 0xFF;

Expand Down
4 changes: 4 additions & 0 deletions src/types/RGBA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export interface RGBA {
alpha?: number;
}

export function RGBAtoRGBColor(rgba: RGBA): RGBColor {
return new RGBColor(rgba.red, rgba.green, rgba.blue, rgba.alpha);
}

export class RGBColor implements RGBA {
/**
* RGB(A) color class, allows for RGB(A) colors to be converted to a Number, among other things.
Expand Down

0 comments on commit dfe8ebd

Please sign in to comment.