2025-08-20 16:41:21 +08:00

285 lines
5.8 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* style.css */
:root {
--primary-color: #1a73e8; /* 谷歌蓝 */
--secondary-color: #34a853; /* 谷歌绿 */
--background-color: #f8f9fa;
--text-color: #3c4043;
--card-bg: #ffffff;
--border-color: #dadce0;
--button-hover-bg: #e8f0fe;
--button-hover-text: #174ea6;
--stop-color: #d93025; /* 谷歌红,用于删除和停止 */
--stop-hover-bg: #fce8e6;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
margin: 0;
padding: 2rem;
background-color: var(--background-color);
color: var(--text-color);
display: flex;
flex-direction: column;
align-items: center;
line-height: 1.6;
}
header {
text-align: center;
margin-bottom: 2rem;
}
h1 {
color: var(--primary-color);
font-size: 2.5rem;
margin-bottom: 0.5rem;
}
h2 {
color: #5f6368;
border-bottom: 2px solid var(--border-color);
padding-bottom: 0.5rem;
margin-top: 0;
}
h3 {
color: var(--primary-color);
margin-top: 0;
}
#main-container {
display: flex;
flex-wrap: wrap;
gap: 2rem;
width: 100%;
max-width: 1200px;
justify-content: center;
}
#video-wrapper, #controls-panel {
background-color: var(--card-bg);
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
padding: 1.5rem;
}
#video-wrapper {
flex: 1;
min-width: 320px;
max-width: 680px;
}
#controls-panel {
flex: 1;
min-width: 300px;
max-width: 450px;
}
#video-container {
position: relative;
width: 100%;
margin: auto;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
aspect-ratio: 640 / 480;
}
#video, #canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#video {
transform: scaleX(-1);
object-fit: cover;
}
#canvas {
transform: scaleX(-1);
background-color: transparent;
}
#status {
background-color: #e8f0fe;
color: var(--primary-color);
padding: 0.75rem;
text-align: center;
border-radius: 4px;
font-weight: 500;
margin-bottom: 1rem;
}
.control-section {
margin-bottom: 2rem;
}
/* ==================== 动态类别UI样式更新 ==================== */
#pose-classes-container {
display: flex;
flex-direction: column;
gap: 0.75rem; /* 类别之间的间距 */
margin-bottom: 1rem;
}
.pose-class {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0.75rem;
border: 1px solid var(--border-color);
border-radius: 4px;
gap: 0.5rem;
}
.class-info {
flex-grow: 1; /* 让信息区域占据更多空间 */
display: flex;
flex-direction: column;
}
/* 📌 新增: 类别名称输入框样式 */
.class-name-input {
border: none;
outline: none;
font-size: 1.1rem;
font-weight: bold;
font-family: inherit;
color: var(--text-color);
background-color: transparent;
padding: 2px 4px;
margin: -2px -4px; /* 抵消padding使其对齐 */
border-radius: 2px;
transition: background-color 0.2s;
}
.class-name-input:focus {
background-color: #e0e0e0;
}
.sample-count {
font-size: 0.9rem;
color: #5f6368;
}
.class-actions {
display: flex;
align-items: center;
gap: 5px; /* 按钮间距 */
}
/* 📌 新增: 删除按钮样式 */
.btn-delete-class {
background: transparent;
border: none;
color: var(--stop-color);
font-size: 1.5rem; /* 让 '×' 更大更清晰 */
line-height: 1;
padding: 0 0.5rem;
cursor: pointer;
border-radius: 50%;
transition: background-color 0.2s;
font-weight: bold;
}
.btn-delete-class:hover {
background-color: var(--stop-hover-bg);
}
/* ========================================================= */
.btn-sample, .btn-predict, .btn-add-class {
padding: 0.5rem 1rem;
border: 1px solid var(--primary-color);
background-color: var(--card-bg);
color: var(--primary-color);
border-radius: 4px;
cursor: pointer;
font-weight: 600;
transition: all 0.2s ease-in-out;
}
.btn-sample:hover, .btn-predict:hover, .btn-add-class:hover {
background-color: var(--button-hover-bg);
color: var(--button-hover-text);
}
.btn-sample:disabled, .btn-predict:disabled, .btn-add-class:disabled {
opacity: 0.5;
cursor: not-allowed;
background-color: var(--card-bg);
color: var(--primary-color);
}
/* 📌 新增: 为“增加分类”按钮添加特定样式 */
.add-class-wrapper {
margin-top: 1rem;
}
.btn-add-class {
width: 100%;
border-style: dashed;
}
.btn-predict.stop {
background-color: var(--stop-color);
border-color: var(--stop-color);
color: white;
}
.btn-predict.stop:hover {
background-color: #a50e0e;
}
#result-container {
margin-top: 1rem;
padding: 1rem;
background-color: #e8f0fe;
border-radius: 4px;
text-align: center;
}
#result-text {
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-color);
}
.model-controls {
display: flex;
gap: 1rem;
}
.btn-auto-sample {
padding: 8px 15px;
font-size: 0.9em;
background-color: #5cb85c; /* 绿色 */
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.2s ease;
margin-right: 8px; /* 与手动采集按钮之间留出间距 */
}
.btn-auto-sample:hover {
background-color: #4cae4c;
}
.btn-auto-sample:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
/* 添加一个停止按钮样式 */
.btn-auto-sample.stop {
background-color: #d9534f; /* 红色 */
}
.btn-auto-sample.stop:hover {
background-color: #c9302c;
}