@lokutor/sdk 1.1.31 → 1.1.32
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.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +34 -15
- package/dist/index.mjs +34 -15
- package/package.json +1 -1
- package/src/conversational-panel.ts +41 -15
package/dist/index.d.mts
CHANGED
|
@@ -657,7 +657,7 @@ declare class ConversationalPanel {
|
|
|
657
657
|
stop(): void;
|
|
658
658
|
/** Update accent color dynamically */
|
|
659
659
|
setColor(color: string): void;
|
|
660
|
-
/** Update background color dynamically */
|
|
660
|
+
/** Update background color dynamically and ensure text/UI contrast */
|
|
661
661
|
setBackgroundColor(color: string): void;
|
|
662
662
|
/** Update title text */
|
|
663
663
|
setTitle(title: string): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -657,7 +657,7 @@ declare class ConversationalPanel {
|
|
|
657
657
|
stop(): void;
|
|
658
658
|
/** Update accent color dynamically */
|
|
659
659
|
setColor(color: string): void;
|
|
660
|
-
/** Update background color dynamically */
|
|
660
|
+
/** Update background color dynamically and ensure text/UI contrast */
|
|
661
661
|
setBackgroundColor(color: string): void;
|
|
662
662
|
/** Update title text */
|
|
663
663
|
setTitle(title: string): void;
|
package/dist/index.js
CHANGED
|
@@ -1310,7 +1310,7 @@ var PANEL_CSS = (
|
|
|
1310
1310
|
flex-direction: column;
|
|
1311
1311
|
align-items: center;
|
|
1312
1312
|
gap: clamp(0.75rem, 1.5vw, 1.5rem);
|
|
1313
|
-
color: #fff;
|
|
1313
|
+
color: var(--cv-text, #fff);
|
|
1314
1314
|
text-align: center;
|
|
1315
1315
|
z-index: 2;
|
|
1316
1316
|
padding: clamp(1rem, 2vw, 2rem);
|
|
@@ -1320,11 +1320,12 @@ var PANEL_CSS = (
|
|
|
1320
1320
|
font-weight: 800;
|
|
1321
1321
|
letter-spacing: -0.03em;
|
|
1322
1322
|
margin: 0;
|
|
1323
|
-
text-shadow: 0 4px 20px rgba(0,0,0,0.
|
|
1323
|
+
text-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
1324
1324
|
}
|
|
1325
1325
|
.cv-curtain-desc {
|
|
1326
1326
|
font-size: clamp(0.75rem, 2vw, 1.1rem);
|
|
1327
1327
|
opacity: 0.8;
|
|
1328
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.8));
|
|
1328
1329
|
max-width: 400px;
|
|
1329
1330
|
margin: 0;
|
|
1330
1331
|
line-height: 1.5;
|
|
@@ -1333,8 +1334,8 @@ var PANEL_CSS = (
|
|
|
1333
1334
|
margin-top: 1rem;
|
|
1334
1335
|
padding: clamp(0.6rem, 1.5vw, 1rem) clamp(1.5rem, 3vw, 2.5rem);
|
|
1335
1336
|
border-radius: 100px;
|
|
1336
|
-
background: #fff;
|
|
1337
|
-
color: #000;
|
|
1337
|
+
background: var(--cv-text, #fff);
|
|
1338
|
+
color: var(--cv-bg, #000);
|
|
1338
1339
|
border: none;
|
|
1339
1340
|
font-weight: 700;
|
|
1340
1341
|
font-size: clamp(0.8rem, 1.5vw, 1rem);
|
|
@@ -1343,12 +1344,12 @@ var PANEL_CSS = (
|
|
|
1343
1344
|
gap: 0.75rem;
|
|
1344
1345
|
cursor: pointer;
|
|
1345
1346
|
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
1346
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.
|
|
1347
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
|
1347
1348
|
}
|
|
1348
1349
|
.cv-curtain-btn:hover {
|
|
1349
1350
|
transform: scale(1.05);
|
|
1350
|
-
|
|
1351
|
-
box-shadow: 0 15px 40px rgba(0,0,0,0.
|
|
1351
|
+
opacity: 0.9;
|
|
1352
|
+
box-shadow: 0 15px 40px rgba(0,0,0,0.2);
|
|
1352
1353
|
}
|
|
1353
1354
|
.cv-curtain-btn svg { transition: transform 0.3s ease; }
|
|
1354
1355
|
.cv-curtain-btn:hover svg { transform: translateX(4px); }
|
|
@@ -1364,7 +1365,7 @@ var PANEL_CSS = (
|
|
|
1364
1365
|
.cv-title {
|
|
1365
1366
|
font-size: clamp(1rem, 2.5vw, 1.75rem);
|
|
1366
1367
|
font-weight: 700;
|
|
1367
|
-
color: #e0e0e0;
|
|
1368
|
+
color: var(--cv-text, #e0e0e0);
|
|
1368
1369
|
display: flex;
|
|
1369
1370
|
align-items: center;
|
|
1370
1371
|
gap: 1rem;
|
|
@@ -1425,13 +1426,13 @@ var PANEL_CSS = (
|
|
|
1425
1426
|
display: flex;
|
|
1426
1427
|
align-items: center;
|
|
1427
1428
|
gap: 0.75rem;
|
|
1428
|
-
background: rgba(255, 255, 255, 0.03);
|
|
1429
|
+
background: var(--cv-ui-bg, rgba(255, 255, 255, 0.03));
|
|
1429
1430
|
backdrop-filter: blur(30px);
|
|
1430
1431
|
-webkit-backdrop-filter: blur(30px);
|
|
1431
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
1432
|
+
border: 1px solid var(--cv-ui-border, rgba(255, 255, 255, 0.08));
|
|
1432
1433
|
padding: 0.3rem 0.75rem;
|
|
1433
1434
|
border-radius: 100px;
|
|
1434
|
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.
|
|
1435
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
|
|
1435
1436
|
}
|
|
1436
1437
|
.cv-btn {
|
|
1437
1438
|
display: flex;
|
|
@@ -1439,7 +1440,7 @@ var PANEL_CSS = (
|
|
|
1439
1440
|
gap: 0.5rem;
|
|
1440
1441
|
background: transparent;
|
|
1441
1442
|
border: none;
|
|
1442
|
-
color: rgba(255,255,255,0.55);
|
|
1443
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.55));
|
|
1443
1444
|
font-weight: 600;
|
|
1444
1445
|
font-size: 0.75rem;
|
|
1445
1446
|
cursor: pointer;
|
|
@@ -1447,7 +1448,7 @@ var PANEL_CSS = (
|
|
|
1447
1448
|
padding: 0.35rem 0.75rem;
|
|
1448
1449
|
border-radius: 50px;
|
|
1449
1450
|
}
|
|
1450
|
-
.cv-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
|
|
1451
|
+
.cv-btn:hover { color: var(--cv-text, #fff); background: var(--cv-ui-bg, rgba(255,255,255,0.05)); }
|
|
1451
1452
|
.cv-btn--end { color: #ff4444; }
|
|
1452
1453
|
.cv-btn--end .cv-btn-box {
|
|
1453
1454
|
background: #ff4444;
|
|
@@ -1536,7 +1537,7 @@ var ConversationalPanel = class {
|
|
|
1536
1537
|
const accent = this.cfg.accentColor || "#a25a6b";
|
|
1537
1538
|
const bg = this.cfg.backgroundColor || "#0a0a0a";
|
|
1538
1539
|
this.container.style.setProperty("--cv-accent", accent);
|
|
1539
|
-
this.
|
|
1540
|
+
this.setBackgroundColor(bg);
|
|
1540
1541
|
this.el = document.createElement("div");
|
|
1541
1542
|
this.el.className = "cv-panel";
|
|
1542
1543
|
this.el.innerHTML = `
|
|
@@ -1744,10 +1745,28 @@ var ConversationalPanel = class {
|
|
|
1744
1745
|
this.visualizer.setAccentColor(r, g, b);
|
|
1745
1746
|
}
|
|
1746
1747
|
}
|
|
1747
|
-
/** Update background color dynamically */
|
|
1748
|
+
/** Update background color dynamically and ensure text/UI contrast */
|
|
1748
1749
|
setBackgroundColor(color) {
|
|
1749
1750
|
this.cfg.backgroundColor = color;
|
|
1750
1751
|
this.container.style.setProperty("--cv-bg", color);
|
|
1752
|
+
let r = 0, g = 0, b = 0;
|
|
1753
|
+
if (color.startsWith("#")) {
|
|
1754
|
+
if (color.length === 4) {
|
|
1755
|
+
r = parseInt(color[1] + color[1], 16);
|
|
1756
|
+
g = parseInt(color[2] + color[2], 16);
|
|
1757
|
+
b = parseInt(color[3] + color[3], 16);
|
|
1758
|
+
} else {
|
|
1759
|
+
r = parseInt(color.slice(1, 3), 16);
|
|
1760
|
+
g = parseInt(color.slice(3, 5), 16);
|
|
1761
|
+
b = parseInt(color.slice(5, 7), 16);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
1765
|
+
const isLight = luminance > 0.5;
|
|
1766
|
+
this.container.style.setProperty("--cv-text", isLight ? "#000000" : "#ffffff");
|
|
1767
|
+
this.container.style.setProperty("--cv-text-dim", isLight ? "rgba(0,0,0,0.6)" : "rgba(255,255,255,0.6)");
|
|
1768
|
+
this.container.style.setProperty("--cv-ui-bg", isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)");
|
|
1769
|
+
this.container.style.setProperty("--cv-ui-border", isLight ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)");
|
|
1751
1770
|
}
|
|
1752
1771
|
/** Update title text */
|
|
1753
1772
|
setTitle(title) {
|
package/dist/index.mjs
CHANGED
|
@@ -1263,7 +1263,7 @@ var PANEL_CSS = (
|
|
|
1263
1263
|
flex-direction: column;
|
|
1264
1264
|
align-items: center;
|
|
1265
1265
|
gap: clamp(0.75rem, 1.5vw, 1.5rem);
|
|
1266
|
-
color: #fff;
|
|
1266
|
+
color: var(--cv-text, #fff);
|
|
1267
1267
|
text-align: center;
|
|
1268
1268
|
z-index: 2;
|
|
1269
1269
|
padding: clamp(1rem, 2vw, 2rem);
|
|
@@ -1273,11 +1273,12 @@ var PANEL_CSS = (
|
|
|
1273
1273
|
font-weight: 800;
|
|
1274
1274
|
letter-spacing: -0.03em;
|
|
1275
1275
|
margin: 0;
|
|
1276
|
-
text-shadow: 0 4px 20px rgba(0,0,0,0.
|
|
1276
|
+
text-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
1277
1277
|
}
|
|
1278
1278
|
.cv-curtain-desc {
|
|
1279
1279
|
font-size: clamp(0.75rem, 2vw, 1.1rem);
|
|
1280
1280
|
opacity: 0.8;
|
|
1281
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.8));
|
|
1281
1282
|
max-width: 400px;
|
|
1282
1283
|
margin: 0;
|
|
1283
1284
|
line-height: 1.5;
|
|
@@ -1286,8 +1287,8 @@ var PANEL_CSS = (
|
|
|
1286
1287
|
margin-top: 1rem;
|
|
1287
1288
|
padding: clamp(0.6rem, 1.5vw, 1rem) clamp(1.5rem, 3vw, 2.5rem);
|
|
1288
1289
|
border-radius: 100px;
|
|
1289
|
-
background: #fff;
|
|
1290
|
-
color: #000;
|
|
1290
|
+
background: var(--cv-text, #fff);
|
|
1291
|
+
color: var(--cv-bg, #000);
|
|
1291
1292
|
border: none;
|
|
1292
1293
|
font-weight: 700;
|
|
1293
1294
|
font-size: clamp(0.8rem, 1.5vw, 1rem);
|
|
@@ -1296,12 +1297,12 @@ var PANEL_CSS = (
|
|
|
1296
1297
|
gap: 0.75rem;
|
|
1297
1298
|
cursor: pointer;
|
|
1298
1299
|
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
1299
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.
|
|
1300
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
|
1300
1301
|
}
|
|
1301
1302
|
.cv-curtain-btn:hover {
|
|
1302
1303
|
transform: scale(1.05);
|
|
1303
|
-
|
|
1304
|
-
box-shadow: 0 15px 40px rgba(0,0,0,0.
|
|
1304
|
+
opacity: 0.9;
|
|
1305
|
+
box-shadow: 0 15px 40px rgba(0,0,0,0.2);
|
|
1305
1306
|
}
|
|
1306
1307
|
.cv-curtain-btn svg { transition: transform 0.3s ease; }
|
|
1307
1308
|
.cv-curtain-btn:hover svg { transform: translateX(4px); }
|
|
@@ -1317,7 +1318,7 @@ var PANEL_CSS = (
|
|
|
1317
1318
|
.cv-title {
|
|
1318
1319
|
font-size: clamp(1rem, 2.5vw, 1.75rem);
|
|
1319
1320
|
font-weight: 700;
|
|
1320
|
-
color: #e0e0e0;
|
|
1321
|
+
color: var(--cv-text, #e0e0e0);
|
|
1321
1322
|
display: flex;
|
|
1322
1323
|
align-items: center;
|
|
1323
1324
|
gap: 1rem;
|
|
@@ -1378,13 +1379,13 @@ var PANEL_CSS = (
|
|
|
1378
1379
|
display: flex;
|
|
1379
1380
|
align-items: center;
|
|
1380
1381
|
gap: 0.75rem;
|
|
1381
|
-
background: rgba(255, 255, 255, 0.03);
|
|
1382
|
+
background: var(--cv-ui-bg, rgba(255, 255, 255, 0.03));
|
|
1382
1383
|
backdrop-filter: blur(30px);
|
|
1383
1384
|
-webkit-backdrop-filter: blur(30px);
|
|
1384
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
1385
|
+
border: 1px solid var(--cv-ui-border, rgba(255, 255, 255, 0.08));
|
|
1385
1386
|
padding: 0.3rem 0.75rem;
|
|
1386
1387
|
border-radius: 100px;
|
|
1387
|
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.
|
|
1388
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
|
|
1388
1389
|
}
|
|
1389
1390
|
.cv-btn {
|
|
1390
1391
|
display: flex;
|
|
@@ -1392,7 +1393,7 @@ var PANEL_CSS = (
|
|
|
1392
1393
|
gap: 0.5rem;
|
|
1393
1394
|
background: transparent;
|
|
1394
1395
|
border: none;
|
|
1395
|
-
color: rgba(255,255,255,0.55);
|
|
1396
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.55));
|
|
1396
1397
|
font-weight: 600;
|
|
1397
1398
|
font-size: 0.75rem;
|
|
1398
1399
|
cursor: pointer;
|
|
@@ -1400,7 +1401,7 @@ var PANEL_CSS = (
|
|
|
1400
1401
|
padding: 0.35rem 0.75rem;
|
|
1401
1402
|
border-radius: 50px;
|
|
1402
1403
|
}
|
|
1403
|
-
.cv-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
|
|
1404
|
+
.cv-btn:hover { color: var(--cv-text, #fff); background: var(--cv-ui-bg, rgba(255,255,255,0.05)); }
|
|
1404
1405
|
.cv-btn--end { color: #ff4444; }
|
|
1405
1406
|
.cv-btn--end .cv-btn-box {
|
|
1406
1407
|
background: #ff4444;
|
|
@@ -1489,7 +1490,7 @@ var ConversationalPanel = class {
|
|
|
1489
1490
|
const accent = this.cfg.accentColor || "#a25a6b";
|
|
1490
1491
|
const bg = this.cfg.backgroundColor || "#0a0a0a";
|
|
1491
1492
|
this.container.style.setProperty("--cv-accent", accent);
|
|
1492
|
-
this.
|
|
1493
|
+
this.setBackgroundColor(bg);
|
|
1493
1494
|
this.el = document.createElement("div");
|
|
1494
1495
|
this.el.className = "cv-panel";
|
|
1495
1496
|
this.el.innerHTML = `
|
|
@@ -1697,10 +1698,28 @@ var ConversationalPanel = class {
|
|
|
1697
1698
|
this.visualizer.setAccentColor(r, g, b);
|
|
1698
1699
|
}
|
|
1699
1700
|
}
|
|
1700
|
-
/** Update background color dynamically */
|
|
1701
|
+
/** Update background color dynamically and ensure text/UI contrast */
|
|
1701
1702
|
setBackgroundColor(color) {
|
|
1702
1703
|
this.cfg.backgroundColor = color;
|
|
1703
1704
|
this.container.style.setProperty("--cv-bg", color);
|
|
1705
|
+
let r = 0, g = 0, b = 0;
|
|
1706
|
+
if (color.startsWith("#")) {
|
|
1707
|
+
if (color.length === 4) {
|
|
1708
|
+
r = parseInt(color[1] + color[1], 16);
|
|
1709
|
+
g = parseInt(color[2] + color[2], 16);
|
|
1710
|
+
b = parseInt(color[3] + color[3], 16);
|
|
1711
|
+
} else {
|
|
1712
|
+
r = parseInt(color.slice(1, 3), 16);
|
|
1713
|
+
g = parseInt(color.slice(3, 5), 16);
|
|
1714
|
+
b = parseInt(color.slice(5, 7), 16);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
1718
|
+
const isLight = luminance > 0.5;
|
|
1719
|
+
this.container.style.setProperty("--cv-text", isLight ? "#000000" : "#ffffff");
|
|
1720
|
+
this.container.style.setProperty("--cv-text-dim", isLight ? "rgba(0,0,0,0.6)" : "rgba(255,255,255,0.6)");
|
|
1721
|
+
this.container.style.setProperty("--cv-ui-bg", isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)");
|
|
1722
|
+
this.container.style.setProperty("--cv-ui-border", isLight ? "rgba(0,0,0,0.1)" : "rgba(255,255,255,0.1)");
|
|
1704
1723
|
}
|
|
1705
1724
|
/** Update title text */
|
|
1706
1725
|
setTitle(title) {
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ const PANEL_CSS = /*css*/ `
|
|
|
45
45
|
flex-direction: column;
|
|
46
46
|
align-items: center;
|
|
47
47
|
gap: clamp(0.75rem, 1.5vw, 1.5rem);
|
|
48
|
-
color: #fff;
|
|
48
|
+
color: var(--cv-text, #fff);
|
|
49
49
|
text-align: center;
|
|
50
50
|
z-index: 2;
|
|
51
51
|
padding: clamp(1rem, 2vw, 2rem);
|
|
@@ -55,11 +55,12 @@ const PANEL_CSS = /*css*/ `
|
|
|
55
55
|
font-weight: 800;
|
|
56
56
|
letter-spacing: -0.03em;
|
|
57
57
|
margin: 0;
|
|
58
|
-
text-shadow: 0 4px 20px rgba(0,0,0,0.
|
|
58
|
+
text-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
59
59
|
}
|
|
60
60
|
.cv-curtain-desc {
|
|
61
61
|
font-size: clamp(0.75rem, 2vw, 1.1rem);
|
|
62
62
|
opacity: 0.8;
|
|
63
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.8));
|
|
63
64
|
max-width: 400px;
|
|
64
65
|
margin: 0;
|
|
65
66
|
line-height: 1.5;
|
|
@@ -68,8 +69,8 @@ const PANEL_CSS = /*css*/ `
|
|
|
68
69
|
margin-top: 1rem;
|
|
69
70
|
padding: clamp(0.6rem, 1.5vw, 1rem) clamp(1.5rem, 3vw, 2.5rem);
|
|
70
71
|
border-radius: 100px;
|
|
71
|
-
background: #fff;
|
|
72
|
-
color: #000;
|
|
72
|
+
background: var(--cv-text, #fff);
|
|
73
|
+
color: var(--cv-bg, #000);
|
|
73
74
|
border: none;
|
|
74
75
|
font-weight: 700;
|
|
75
76
|
font-size: clamp(0.8rem, 1.5vw, 1rem);
|
|
@@ -78,12 +79,12 @@ const PANEL_CSS = /*css*/ `
|
|
|
78
79
|
gap: 0.75rem;
|
|
79
80
|
cursor: pointer;
|
|
80
81
|
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
81
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.
|
|
82
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
|
82
83
|
}
|
|
83
84
|
.cv-curtain-btn:hover {
|
|
84
85
|
transform: scale(1.05);
|
|
85
|
-
|
|
86
|
-
box-shadow: 0 15px 40px rgba(0,0,0,0.
|
|
86
|
+
opacity: 0.9;
|
|
87
|
+
box-shadow: 0 15px 40px rgba(0,0,0,0.2);
|
|
87
88
|
}
|
|
88
89
|
.cv-curtain-btn svg { transition: transform 0.3s ease; }
|
|
89
90
|
.cv-curtain-btn:hover svg { transform: translateX(4px); }
|
|
@@ -99,7 +100,7 @@ const PANEL_CSS = /*css*/ `
|
|
|
99
100
|
.cv-title {
|
|
100
101
|
font-size: clamp(1rem, 2.5vw, 1.75rem);
|
|
101
102
|
font-weight: 700;
|
|
102
|
-
color: #e0e0e0;
|
|
103
|
+
color: var(--cv-text, #e0e0e0);
|
|
103
104
|
display: flex;
|
|
104
105
|
align-items: center;
|
|
105
106
|
gap: 1rem;
|
|
@@ -160,13 +161,13 @@ const PANEL_CSS = /*css*/ `
|
|
|
160
161
|
display: flex;
|
|
161
162
|
align-items: center;
|
|
162
163
|
gap: 0.75rem;
|
|
163
|
-
background: rgba(255, 255, 255, 0.03);
|
|
164
|
+
background: var(--cv-ui-bg, rgba(255, 255, 255, 0.03));
|
|
164
165
|
backdrop-filter: blur(30px);
|
|
165
166
|
-webkit-backdrop-filter: blur(30px);
|
|
166
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
167
|
+
border: 1px solid var(--cv-ui-border, rgba(255, 255, 255, 0.08));
|
|
167
168
|
padding: 0.3rem 0.75rem;
|
|
168
169
|
border-radius: 100px;
|
|
169
|
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.
|
|
170
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
|
|
170
171
|
}
|
|
171
172
|
.cv-btn {
|
|
172
173
|
display: flex;
|
|
@@ -174,7 +175,7 @@ const PANEL_CSS = /*css*/ `
|
|
|
174
175
|
gap: 0.5rem;
|
|
175
176
|
background: transparent;
|
|
176
177
|
border: none;
|
|
177
|
-
color: rgba(255,255,255,0.55);
|
|
178
|
+
color: var(--cv-text-dim, rgba(255,255,255,0.55));
|
|
178
179
|
font-weight: 600;
|
|
179
180
|
font-size: 0.75rem;
|
|
180
181
|
cursor: pointer;
|
|
@@ -182,7 +183,7 @@ const PANEL_CSS = /*css*/ `
|
|
|
182
183
|
padding: 0.35rem 0.75rem;
|
|
183
184
|
border-radius: 50px;
|
|
184
185
|
}
|
|
185
|
-
.cv-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
|
|
186
|
+
.cv-btn:hover { color: var(--cv-text, #fff); background: var(--cv-ui-bg, rgba(255,255,255,0.05)); }
|
|
186
187
|
.cv-btn--end { color: #ff4444; }
|
|
187
188
|
.cv-btn--end .cv-btn-box {
|
|
188
189
|
background: #ff4444;
|
|
@@ -307,7 +308,7 @@ export class ConversationalPanel {
|
|
|
307
308
|
const bg = this.cfg.backgroundColor || '#0a0a0a';
|
|
308
309
|
|
|
309
310
|
this.container.style.setProperty('--cv-accent', accent);
|
|
310
|
-
this.
|
|
311
|
+
this.setBackgroundColor(bg);
|
|
311
312
|
|
|
312
313
|
this.el = document.createElement('div');
|
|
313
314
|
this.el.className = 'cv-panel';
|
|
@@ -528,10 +529,35 @@ export class ConversationalPanel {
|
|
|
528
529
|
}
|
|
529
530
|
}
|
|
530
531
|
|
|
531
|
-
/** Update background color dynamically */
|
|
532
|
+
/** Update background color dynamically and ensure text/UI contrast */
|
|
532
533
|
setBackgroundColor(color: string) {
|
|
533
534
|
this.cfg.backgroundColor = color;
|
|
534
535
|
this.container.style.setProperty('--cv-bg', color);
|
|
536
|
+
|
|
537
|
+
// Calculate luminance to decide on light/dark theme contrast
|
|
538
|
+
// Simple hex to RGB conversion
|
|
539
|
+
let r = 0, g = 0, b = 0;
|
|
540
|
+
if (color.startsWith('#')) {
|
|
541
|
+
if (color.length === 4) {
|
|
542
|
+
r = parseInt(color[1] + color[1], 16);
|
|
543
|
+
g = parseInt(color[2] + color[2], 16);
|
|
544
|
+
b = parseInt(color[3] + color[3], 16);
|
|
545
|
+
} else {
|
|
546
|
+
r = parseInt(color.slice(1, 3), 16);
|
|
547
|
+
g = parseInt(color.slice(3, 5), 16);
|
|
548
|
+
b = parseInt(color.slice(5, 7), 16);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Relative luminance formula
|
|
553
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
554
|
+
const isLight = luminance > 0.5;
|
|
555
|
+
|
|
556
|
+
// Set contrast variables
|
|
557
|
+
this.container.style.setProperty('--cv-text', isLight ? '#000000' : '#ffffff');
|
|
558
|
+
this.container.style.setProperty('--cv-text-dim', isLight ? 'rgba(0,0,0,0.6)' : 'rgba(255,255,255,0.6)');
|
|
559
|
+
this.container.style.setProperty('--cv-ui-bg', isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.05)');
|
|
560
|
+
this.container.style.setProperty('--cv-ui-border', isLight ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.1)');
|
|
535
561
|
}
|
|
536
562
|
|
|
537
563
|
/** Update title text */
|