@rpg-engine/long-bow 0.8.12 → 0.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare const toUppercaseHexColor: (color: string | undefined) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import { GRID_HEIGHT, GRID_WIDTH } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
+ import { toUppercaseHexColor } from '../../utils/colorUtils';
4
5
 
5
6
  interface IProps {
6
7
  atlasJSON: any;
@@ -51,6 +52,8 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
51
52
  return null;
52
53
  }
53
54
 
55
+ const normalizedTintColor = toUppercaseHexColor(tintColor);
56
+
54
57
  return (
55
58
  <Container
56
59
  width={width}
@@ -69,7 +72,7 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
69
72
  style={imgStyle}
70
73
  centered={centered}
71
74
  borderRadius={borderRadius}
72
- tintColor={tintColor}
75
+ tintColor={normalizedTintColor}
73
76
  />
74
77
  </Container>
75
78
  );
@@ -0,0 +1,11 @@
1
+ export const toUppercaseHexColor = (
2
+ color: string | undefined
3
+ ): string | undefined => {
4
+ if (!color) return undefined;
5
+
6
+ // Check if it's a valid hex color
7
+ const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
8
+ if (!hexRegex.test(color)) return color;
9
+
10
+ return color.toUpperCase();
11
+ };