Your chat display name is what people see when you send chat messages. Other information can
@@ -32,13 +61,28 @@ export default function NameChangeModal(props: Props) {
value={newName}
onChange={e => setNewName(e.target.value)}
placeholder="Your chat display name"
- maxLength={10}
+ maxLength={30}
showCount
defaultValue={chatDisplayName}
/>
+
+ Your Color
+
+
);
}
diff --git a/web/components/stores/ClientConfigStore.tsx b/web/components/stores/ClientConfigStore.tsx
index ef056f579..880c1ac4c 100644
--- a/web/components/stores/ClientConfigStore.tsx
+++ b/web/components/stores/ClientConfigStore.tsx
@@ -46,6 +46,11 @@ export const chatDisplayNameAtom = atom({
default: null,
});
+export const chatDisplayColorAtom = atom({
+ key: 'chatDisplayColor',
+ default: null,
+});
+
export const chatUserIdAtom = atom({
key: 'chatUserIdAtom',
default: null,
@@ -149,6 +154,7 @@ export function ClientConfigStore() {
const [appState, appStateSend, appStateService] = useMachine(appStateModel);
const setChatDisplayName = useSetRecoilState(chatDisplayNameAtom);
+ const setChatDisplayColor = useSetRecoilState(chatDisplayColorAtom);
const setChatUserId = useSetRecoilState(chatUserIdAtom);
const setIsChatModerator = useSetRecoilState(isChatModeratorAtom);
const setClientConfig = useSetRecoilState(clientConfigStateAtom);
@@ -225,7 +231,7 @@ export function ClientConfigStore() {
sendEvent(AppStateEvent.NeedsRegister);
const response = await ChatService.registerUser(optionalDisplayName);
console.log(`ChatService -> registerUser() response: \n${response}`);
- const { accessToken: newAccessToken, displayName: newDisplayName } = response;
+ const { accessToken: newAccessToken, displayName: newDisplayName, displayColor } = response;
if (!newAccessToken) {
return;
}
@@ -234,6 +240,7 @@ export function ClientConfigStore() {
setAccessToken(newAccessToken);
setLocalStorage(ACCESS_TOKEN_KEY, newAccessToken);
setChatDisplayName(newDisplayName);
+ setChatDisplayColor(displayColor);
} catch (e) {
sendEvent(AppStateEvent.Fail);
console.error(`ChatService -> registerUser() ERROR: \n${e}`);
@@ -255,6 +262,7 @@ export function ClientConfigStore() {
handleConnectedClientInfoMessage(
message as ConnectedClientInfoEvent,
setChatDisplayName,
+ setChatDisplayColor,
setChatUserId,
setIsChatModerator,
);
diff --git a/web/components/stores/eventhandlers/connected-client-info-handler.ts b/web/components/stores/eventhandlers/connected-client-info-handler.ts
index fe6454ec3..6063a5480 100644
--- a/web/components/stores/eventhandlers/connected-client-info-handler.ts
+++ b/web/components/stores/eventhandlers/connected-client-info-handler.ts
@@ -3,12 +3,14 @@ import { ConnectedClientInfoEvent } from '../../../interfaces/socket-events';
export default function handleConnectedClientInfoMessage(
message: ConnectedClientInfoEvent,
setChatDisplayName: (string) => void,
+ setChatDisplayColor: (number) => void,
setChatUserId: (number) => void,
setIsChatModerator: (boolean) => void,
) {
const { user } = message;
- const { id, displayName, scopes } = user;
+ const { id, displayName, displayColor, scopes } = user;
setChatDisplayName(displayName);
+ setChatDisplayColor(displayColor);
setChatUserId(id);
setIsChatModerator(scopes?.includes('moderator'));
}
diff --git a/web/interfaces/socket-events.ts b/web/interfaces/socket-events.ts
index 46beb88de..1672ae712 100644
--- a/web/interfaces/socket-events.ts
+++ b/web/interfaces/socket-events.ts
@@ -4,6 +4,7 @@ export enum MessageType {
CHAT = 'CHAT',
PING = 'PING',
NAME_CHANGE = 'NAME_CHANGE',
+ COLOR_CHANGE = 'COLOR_CHANGE',
PONG = 'PONG',
SYSTEM = 'SYSTEM',
USER_JOINED = 'USER_JOINED',
diff --git a/web/services/chat-service.ts b/web/services/chat-service.ts
index c84cab452..b287fc83f 100644
--- a/web/services/chat-service.ts
+++ b/web/services/chat-service.ts
@@ -8,6 +8,7 @@ interface UserRegistrationResponse {
id: string;
accessToken: string;
displayName: string;
+ displayColor: number;
}
class ChatService {
diff --git a/web/stories/Colors.stories.mdx b/web/stories/Colors.stories.mdx
index e111e891a..43e3a2f8a 100644
--- a/web/stories/Colors.stories.mdx
+++ b/web/stories/Colors.stories.mdx
@@ -22,6 +22,7 @@ Toggle dark mode on and off in the above toolbar to see how these colors look on
diff --git a/web/style-definitions/tokens/color/default-theme.yaml b/web/style-definitions/tokens/color/default-theme.yaml
index 0c1616389..2d1dbaf38 100644
--- a/web/style-definitions/tokens/color/default-theme.yaml
+++ b/web/style-definitions/tokens/color/default-theme.yaml
@@ -36,19 +36,19 @@ theme:
user-colors:
comment: 'Colors used to display chat users.'
- 1:
+ 0:
value: '{color.owncast.user.1.value}'
- 2:
+ 1:
value: '{color.owncast.user.2.value}'
- 3:
+ 2:
value: '{color.owncast.user.3.value}'
- 4:
+ 3:
value: '{color.owncast.user.4.value}'
- 5:
+ 4:
value: '{color.owncast.user.5.value}'
- 6:
+ 5:
value: '{color.owncast.user.6.value}'
- 7:
+ 6:
value: '{color.owncast.user.7.value}'
- 8:
+ 7:
value: '{color.owncast.user.8.value}'
diff --git a/web/styles/theme.less b/web/styles/theme.less
index 712308d4c..aaef2fcdb 100644
--- a/web/styles/theme.less
+++ b/web/styles/theme.less
@@ -1,6 +1,6 @@
// Do not edit directly
-// Generated on Tue, 12 Jul 2022 21:03:36 GMT
+// Generated on Wed, 10 Aug 2022 02:31:18 GMT
//
// How to edit these values:
// Edit the corresponding token file under the style-definitions directory
@@ -26,14 +26,14 @@
@theme-background-primary: #fffcf2; // The main background color of the page.
@theme-background-secondary: #f0efe4; // A secondary background color used in sections and controls.
@theme-rounded-corners: 0.5em;
-@theme-user-colors-1: #f40b0b;
-@theme-user-colors-2: #f4800b;
-@theme-user-colors-3: #f4f40b;
-@theme-user-colors-4: #58f40b;
-@theme-user-colors-5: #0bf4f4;
-@theme-user-colors-6: #0ba6f4;
-@theme-user-colors-7: #6666ff;
-@theme-user-colors-8: #f40bf4;
+@theme-user-colors-0: #f40b0b;
+@theme-user-colors-1: #f4800b;
+@theme-user-colors-2: #f4f40b;
+@theme-user-colors-3: #58f40b;
+@theme-user-colors-4: #0bf4f4;
+@theme-user-colors-5: #0ba6f4;
+@theme-user-colors-6: #6666ff;
+@theme-user-colors-7: #f40bf4;
@owncast-purple: #00ff00;
@owncast-purple-25: rgba(120, 113, 255, 0.25);
@owncast-purple-50: rgba(120, 113, 255, 0.5);
diff --git a/web/styles/variables.css b/web/styles/variables.css
index 29b94d6ea..10647d4e3 100644
--- a/web/styles/variables.css
+++ b/web/styles/variables.css
@@ -1,6 +1,6 @@
/**
* Do not edit directly
- * Generated on Tue, 12 Jul 2022 21:03:36 GMT
+ * Generated on Wed, 10 Aug 2022 02:31:18 GMT
*
* How to edit these values:
* Edit the corresponding token file under the style-definitions directory
@@ -23,23 +23,19 @@
--theme-text-primary: #030208; /* The color of the text in the application. */
--theme-text-secondary: #63638e;
--theme-text-link: #5353a6;
- --theme-text-body-font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont,
- 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
- --theme-text-display-font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont,
- 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
+ --theme-text-body-font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
+ --theme-text-display-font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--theme-background-primary: #fffcf2; /* The main background color of the page. */
--theme-background-secondary: #f0efe4; /* A secondary background color used in sections and controls. */
--theme-rounded-corners: 0.5em;
- --theme-user-colors-1: #f40b0b;
- --theme-user-colors-2: #f4800b;
- --theme-user-colors-3: #f4f40b;
- --theme-user-colors-4: #58f40b;
- --theme-user-colors-5: #0bf4f4;
- --theme-user-colors-6: #0ba6f4;
- --theme-user-colors-7: #6666ff;
- --theme-user-colors-8: #f40bf4;
+ --theme-user-colors-0: #f40b0b;
+ --theme-user-colors-1: #f4800b;
+ --theme-user-colors-2: #f4f40b;
+ --theme-user-colors-3: #58f40b;
+ --theme-user-colors-4: #0bf4f4;
+ --theme-user-colors-5: #0ba6f4;
+ --theme-user-colors-6: #6666ff;
+ --theme-user-colors-7: #f40bf4;
--owncast-purple: #00ff00;
--owncast-purple-25: rgba(120, 113, 255, 0.25);
--owncast-purple-50: rgba(120, 113, 255, 0.5);
@@ -71,10 +67,6 @@
--color-owncast-background-primary: #fffcf2;
--color-owncast-background-secondary: #f0efe4;
--rounded-corners: 0.5em;
- --font-owncast-body: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
- 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
- 'Segoe UI Symbol', 'Noto Color Emoji';
- --font-owncast-display: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
- Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
- 'Segoe UI Symbol', 'Noto Color Emoji';
+ --font-owncast-body: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
+ --font-owncast-display: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}