Classic chat: force left align; 15-color username palette

This commit is contained in:
Clay 2026-12-02 23:06:42 -05:00
parent a525f25437
commit ba9ec92d9c
3 changed files with 11 additions and 5 deletions

View file

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web OSCAR Chat</title> <title>Web OSCAR Chat</title>
<link rel="stylesheet" href="/style.css?v=13"> <link rel="stylesheet" href="/style.css?v=14">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
@ -87,6 +87,6 @@
</main> </main>
</div> </div>
<script type="module" src="/app.js?v=13"></script> <script type="module" src="/app.js?v=14"></script>
</body> </body>
</html> </html>

View file

@ -21,12 +21,17 @@ export function getMessageStyle() {
return v === 'classic' ? 'classic' : 'bubbles'; return v === 'classic' ? 'classic' : 'bubbles';
} }
const NAME_COLORS = [
'#6ee7ff', '#ff7ab6', '#7CFF6B', '#ffd166', '#c792ea',
'#ff9f43', '#4dd0e1', '#f78fb3', '#a8e063', '#82aaff',
'#f6c177', '#ff6b6b', '#5ad1a3', '#d4a5ff', '#f9f871',
];
function nameColor(name) { function nameColor(name) {
let hash = 0; let hash = 0;
const s = String(name || 'unknown'); const s = String(name || 'unknown').toLowerCase();
for (let i = 0; i < s.length; i++) hash = ((hash << 5) - hash) + s.charCodeAt(i); for (let i = 0; i < s.length; i++) hash = ((hash << 5) - hash) + s.charCodeAt(i);
const hue = Math.abs(hash) % 360; return NAME_COLORS[Math.abs(hash) % NAME_COLORS.length];
return `hsl(${hue} 70% 70%)`;
} }
export function setMessageStyle(style) { export function setMessageStyle(style) {
const v = style === 'classic' ? 'classic' : 'bubbles'; const v = style === 'classic' ? 'classic' : 'bubbles';

View file

@ -177,6 +177,7 @@ main { padding: 1rem; max-width: 1600px; margin: 0 auto; }
padding: 0.1rem 0; padding: 0.1rem 0;
background: transparent; background: transparent;
border: none; border: none;
align-self: flex-start;
} }
.messages.style-classic .msg .meta { .messages.style-classic .msg .meta {
display: inline; display: inline;