Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content and styling improvements #881

Merged
merged 19 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prototype different timeseries colors in dark mode
  • Loading branch information
sarahfossheim committed Jun 10, 2024
commit 2cbd53da9ff7dce89adda702cdf09aad227a3e40
12 changes: 12 additions & 0 deletions config/techreport.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,18 @@
"#8E3496",
"#CB377C"
],
"app_dark": [
"#5980EB",
"#D55316",
"#A8A9CA",
"#68A16D",
"#B979A7",
"#AC8D1C",
"#947786",
"#449DB1",
"#C861D2",
"#E24070"
],
"overrides": {
"WordPress": "#fff000"
}
Expand Down
3 changes: 0 additions & 3 deletions src/js/techreport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ class TechReport {
fetch(url)
.then(result => result.json())
.then(result => {
console.log('info result', result);
console.log(result);
const techInfo = result[0];

const categoryListEl = document.getElementsByClassName('category-list')[0];
Expand Down Expand Up @@ -347,7 +345,6 @@ class TechReport {
const body = document.querySelector('body');
if(series?.breakdown == 'client') {
series?.breakdown_values?.forEach((breakdown) => {
console.log('set breakdown color', breakdown.color)
body.style.setProperty(`--breakdown-color-${breakdown.name}`, breakdown.color);
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/js/techreport/utils/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ const getAppColor = (tech, technologies, colors) => {
const sortedTechs = [...technologies].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
const techIndex = sortedTechs.indexOf(tech);

// Get color scheme
const theme = document.querySelector('html').dataset.theme;

// Return custom colors if configured
if(colors.overrides && colors.overrides[tech]) {
return colors.overrides[tech];
}

// Otherwise reutrn based on alphabetic position
if(techIndex < colors.app.length) {
return colors.app[techIndex];
const appColors = theme === "dark" ? colors.app_dark : colors.app;
return appColors[techIndex];
}
}

Expand Down