pick-distinct-colors
Version:
A collection of algorithms and utilities for analyzing and selecting maximally distinct colors. Now includes a unified pickDistinctColors API for easy color selection.
246 lines (210 loc) • 4.11 kB
CSS
.swatch {
width: 50px;
height: 50px;
display: inline-block;
margin: 5px;
border: 1px solid #ccc;
}
.algorithm-section {
margin: 20px;
padding: 20px;
border: 1px solid #ddd;
}
.metrics {
font-family: monospace;
}
.control-panel {
margin: 20px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
}
.input-group {
margin: 10px 0;
}
.input-group label {
margin-right: 10px;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.spinner {
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 20px auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.processing {
text-align: center;
padding: 20px;
background: rgba(255, 255, 255, 0.9);
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
z-index: 1000;
}
.algorithm-settings {
margin: 10px 0;
padding: 10px;
border: 1px solid #eee;
border-radius: 5px;
display: none; /* Hidden by default */
background-color: #f8f8f8; /* Light background */
color: #333; /* Dark text */
}
.algorithm-settings h4 {
margin: 0 0 10px 0;
color: #333;
}
.algorithm-settings div {
margin: 5px 0;
}
.algorithm-settings label {
display: inline-block;
width: 150px;
}
.algorithm-settings input {
width: 100px;
}
.settings-toggle {
background: #f0f0f0;
border: 1px solid #ddd;
padding: 10px;
width: 100%;
text-align: left;
cursor: pointer;
border-radius: 4px;
margin: 5px 0;
color: #333; /* Dark text */
}
.settings-toggle:hover {
background: #e0e0e0;
}
.settings-toggle::after {
content: '▼';
float: right;
}
.settings-toggle.active::after {
content: '▲';
}
.settings-container.show .algorithm-settings {
display: block;
}
/* Footer styles */
.footer {
margin-top: 40px;
padding: 20px;
text-align: center;
border-top: 1px solid #ddd;
color: #666;
font-style: italic;
font-size: 0.9em;
}
.swatch-container {
display: flex;
flex-wrap: wrap;
max-width: 100%;
}
.processing .cancel-button {
margin-top: 10px;
padding: 5px 15px;
background-color: #ff4444;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
display: none; /* Hidden by default */
}
.processing .cancel-button:hover {
background-color: #cc0000;
}
/* Make rankings always appear at the bottom */
.algorithm-section[data-type="summary"] {
order: 999;
}
#results {
display: flex;
flex-direction: column;
}
/* Modal styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
z-index: 1001;
}
.modal-content {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 20px;
border-radius: 5px;
max-width: 80%;
max-height: 80%;
overflow: auto;
}
.export-button {
background-color: #3498db;
margin-left: 10px;
font-size: 0.9em;
}
.export-button:hover {
background-color: #2980b9;
}
.close-modal {
position: absolute;
right: 10px;
top: 10px;
cursor: pointer;
font-size: 20px;
}
.format-selector {
margin-bottom: 10px;
}
.copy-button {
margin-top: 10px;
background-color: #3498db;
}
/* Import panel styles */
.import-panel {
margin-top: 10px;
padding: 10px;
border: 1px solid #eee;
border-radius: 5px;
background-color: #f8f8f8;
}
.import-panel textarea {
width: 100%;
min-height: 100px;
margin: 10px 0;
font-family: monospace;
}
.import-error {
color: #ff0000;
margin-top: 5px;
display: none;
}