trace-chart
Version:
A lightweight, fully customizable financial charting library for global markets
788 lines (667 loc) • 13.1 kB
CSS
/**
* Trace Chart CSS - Complete UI Styling
*
* @author Shobhit Srivastava
* @license Apache 2.0
*
* Comprehensive styling for the financial charting interface including
* toolbar, search, chart area, settings modal, and responsive design.
*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: inherit;
}
body {
font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a1a;
color: #bbbbbb;
overflow: hidden;
font-size: 14px;
}
.chart-container {
display: flex;
height: 100vh;
width: 100%;
}
.toolbar {
width: 60px;
background: rgba(68, 68, 68, 0.1);
border-right: 1px solid #404040;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px 5px;
overflow: visible;
}
.toolbar-section {
margin-bottom: 15px;
position: relative;
}
.dropdown-container {
position: relative;
display: inline-block;
}
.dropdown-button {
width: 40px;
height: 40px;
border: none;
border-radius: 6px;
background: #404040;
color: #BBBBBB;
cursor: pointer;
font-size: 16px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.dropdown-button:hover {
background: #505050;
}
.dropdown-button::after {
content: '';
position: absolute;
right: 2px;
bottom: 2px;
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid #888;
}
.settings-button {
width: 40px;
height: 40px;
border: none;
border-radius: 6px;
background: #404040;
color: #ffffff;
cursor: pointer;
font-size: 16px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
}
.settings-button:hover {
background: #505050;
}
.dropdown-menu {
position: fixed;
background: #2d2d2d;
border: 1px solid #404040;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
min-width: 200px;
z-index: 1000;
display: none;
overflow: hidden;
}
.dropdown-menu.show {
display: block;
}
.dropdown-item {
padding: 10px 15px;
cursor: pointer;
font-size: 13px;
color: #ffffff;
border-bottom: 1px solid #404040;
display: flex;
align-items: center;
gap: 10px;
transition: background 0.2s;
}
.dropdown-item:last-child {
border-bottom: none;
}
.dropdown-item:hover {
background: #404040;
}
.dropdown-item.active {
background: #007acc;
color: #ffffff;
}
.dropdown-item-icon {
font-size: 14px;
width: 30px;
text-align: center;
}
.dropdown-item-icon img {
height: 30px;
}
.dropdown-item-text {
flex: 1;
}
.dropdown-item.active::after {
content: '✓';
color: #4caf50;
font-size: 12px;
margin-left: auto;
}
.dropdown-separator {
height: 1px;
background: #404040;
margin: 5px 0;
}
.chart-wrapper {
flex: 1;
display: flex;
flex-direction: column;
}
.chart-header {
height: 60px;
background: rgba(68, 68, 68, 0.1);
border-bottom: 1px solid #404040;
display: flex;
align-items: center;
padding: 0 20px;
gap: 20px;
}
.search-container {
position: relative;
flex: 1;
max-width: 400px;
}
.search-input {
width: 100%;
height: 36px;
padding: 0 40px 0 12px;
background: rgba(0, 0, 0, 0);
border: 1px solid #555;
border-radius: 6px;
color: #ffffff;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
transition: all 0.2s;
}
.search-input:focus {
outline: none;
border-color: #007acc;
box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}
.search-input::placeholder {
color: #888;
}
.search-icon {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
color: #888;
font-size: 14px;
}
.search-icon img {
height: 22px;
position: relative;
top: 2px;
}
.search-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #2d2d2d;
border: 1px solid #404040;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 2000;
display: none;
margin-top: 4px;
}
.search-dropdown.show {
display: block;
}
.search-filters {
display: flex;
padding: 10px 15px;
gap: 10px;
border-bottom: 1px solid #404040;
}
.filter-chip {
padding: 4px 8px;
background: #404040;
border: 1px solid #555;
border-radius: 4px;
color: #ffffff;
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
}
.filter-chip:hover {
background: #505050;
}
.filter-chip.active {
background: #007acc;
border-color: #007acc;
}
.search-results {
max-height: 300px;
overflow-y: auto;
}
.search-result-item {
padding: 12px 15px;
cursor: pointer;
border-bottom: 1px solid #404040;
transition: background 0.2s;
}
.search-result-item:last-child {
border-bottom: none;
}
.search-result-item:hover {
background: #404040;
}
.search-result-symbol {
font-weight: 600;
color: #ffffff;
font-size: 14px;
}
.search-result-exchange {
color: #888;
font-size: 12px;
margin-top: 2px;
}
.search-result-meta {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 4px;
}
.search-result-type {
background: #555;
color: #ffffff;
padding: 2px 6px;
border-radius: 3px;
font-size: 10px;
font-weight: 500;
}
.search-result-type.equity {
background: #4caf50;
}
.search-result-type.futures {
background: #ff9800;
}
.search-result-type.options {
background: #9c27b0;
}
.search-result-type.commodity {
background: #607d8b;
}
.symbol-info {
display: flex;
align-items: center;
gap: 10px;
font-size: 16px;
font-weight: 400;
}
.symbol-name {
color: #BBBBBB;
}
.symbol-exchange {
color: #888;
font-size: 12px;
font-weight: 400;
}
.price-info {
display: flex;
align-items: center;
gap: 15px;
font-size: 14px;
margin-left: auto;
}
.current-price {
font-weight: 400;
font-size: 16px;
}
.price-change.positive {
color: #4caf50;
}
.price-change.negative {
color: #f44336;
}
.last-update {
color: #5B9A5D;
text-transform: uppercase;
font-size: 12px;
margin-right: 10px;
}
.last-update::before {
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
background-color: rgb(91, 154, 93);
display: inline-block;
animation: pulse 2s infinite;
margin-right: 6px;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(91, 154, 93, 0.7);
}
70% {
box-shadow: 0 0 0 6px rgba(91, 154, 93, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(91, 154, 93, 0);
}
}
.main-chart {
flex: 1;
position: relative;
overflow: hidden;
}
.status-bar {
height: 30px;
background: rgba(68, 68, 68, 0.1);
border-top: 1px solid #404040;
display: flex;
align-items: center;
padding: 0 20px;
font-size: 12px;
color: #cccccc;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #cccccc;
font-size: 16px;
z-index: 10;
}
.error-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #f44336;
font-size: 16px;
text-align: center;
z-index: 10;
}
.settings-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: none;
justify-content: center;
align-items: center;
z-index: 3000;
}
.settings-modal.show {
display: flex;
}
.settings-content {
background: #2d2d2d;
border-radius: 8px;
width: 500px;
max-width: 90vw;
max-height: 80vh;
overflow-y: auto;
border: 1px solid #404040;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.settings-header {
padding: 20px;
border-bottom: 1px solid #404040;
display: flex;
justify-content: space-between;
align-items: center;
}
.settings-title {
font-size: 18px;
font-weight: 600;
color: #ffffff;
display: flex;
align-items: center;
}
.settings-title img {
height: 20px;
margin-right: 10px;
}
.settings-close {
background: none;
border: none;
color: #888;
font-size: 20px;
cursor: pointer;
transition: color 0.2s;
}
.settings-close:hover {
color: #ffffff;
}
.settings-body {
padding: 20px;
}
.settings-section {
margin-bottom: 24px;
}
.settings-section:last-child {
margin-bottom: 0;
}
.settings-section-title {
font-size: 14px;
font-weight: 600;
color: #ffffff;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.settings-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.settings-row:last-child {
margin-bottom: 0;
}
.settings-label {
font-size: 13px;
color: #cccccc;
flex: 1;
}
.settings-control {
display: flex;
align-items: center;
gap: 8px;
}
.settings-toggle {
position: relative;
width: 44px;
height: 24px;
background: #404040;
border-radius: 12px;
cursor: pointer;
transition: background 0.2s;
}
.settings-toggle.active {
background: #007acc;
}
.settings-toggle::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 20px;
height: 20px;
background: #ffffff;
border-radius: 50%;
transition: transform 0.2s;
}
.settings-toggle.active::after {
transform: translateX(20px);
}
.settings-color {
width: 32px;
height: 24px;
border-radius: 4px;
border: 1px solid #404040;
cursor: pointer;
transition: border-color 0.2s;
}
.settings-color:hover {
border-color: #007acc;
}
.settings-select {
background: #404040;
border: 1px solid #555;
border-radius: 4px;
color: #ffffff;
font-size: 13px;
padding: 4px 8px;
min-width: 100px;
cursor: pointer;
}
.settings-select:focus {
outline: none;
border-color: #007acc;
}
.settings-divider {
height: 1px;
background: #404040;
margin: 16px 0;
}
.settings-footer {
padding: 16px 20px;
border-top: 1px solid #404040;
display: flex;
justify-content: flex-end;
gap: 12px;
}
.settings-footer .settings-button {
width: auto;
}
.settings-footer .settings-button {
padding: 8px 16px;
border: none;
border-radius: 4px;
font-size: 13px;
cursor: pointer;
transition: background 0.2s;
}
.settings-button.primary {
background: #007acc;
color: #ffffff;
}
.settings-button.primary:hover {
background: #0056b3;
}
.settings-button.secondary {
background: #404040;
color: #ffffff;
}
.settings-button.secondary:hover {
background: #505050;
}
@media (max-width: 768px) {
.dropdown-menu {
min-width: 180px;
}
.search-container {
max-width: 250px;
}
.chart-header {
padding: 0 10px;
}
.symbol-name {
font-size: 14px;
}
.symbol-exchange {
font-size: 11px;
}
.current-price {
font-size: 14px;
}
.price-info {
font-size: 12px;
}
.last-update {
font-size: 11px;
}
.last-update::before {
margin-right: 5px;
}
.trace-logo {
width: 200px;
}
}
@media (max-width: 480px) {
.dropdown-menu {
min-width: 160px;
}
.toolbar {
width: 50px;
}
.dropdown-button, .settings-button {
width: 35px;
height: 35px;
font-size: 14px;
}
}
.dropdown-container {
z-index: 1001;
}
.dropdown-menu {
z-index: 1002;
}
.search-results::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar {
width: 6px;
}
.search-results::-webkit-scrollbar-track,
.dropdown-menu::-webkit-scrollbar-track {
background: #1a1a1a;
}
.search-results::-webkit-scrollbar-thumb,
.dropdown-menu::-webkit-scrollbar-thumb {
background: #555;
border-radius: 3px;
}
.search-results::-webkit-scrollbar-thumb:hover,
.dropdown-menu::-webkit-scrollbar-thumb:hover {
background: #666;
}
button {
width: auto;
}
button img {
height: 25px;
}
.drawing-context-menu {
position: fixed;
background: #2d2d2d;
border: 1px solid #404040;
border-radius: 4px;
padding: 4px 0;
z-index: 10000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
min-width: 150px;
}
.context-menu-item {
padding: 8px 16px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
color: #ffffff;
}
.context-menu-item:hover {
background: rgba(255, 255, 255, 0.1);
}
.context-menu-icon {
display: flex;
}
.context-menu-icon img {
height: 20px;
}
#intervalsMenu .dropdown-item-icon {
display: none;
}