Make themes work, some color tweaks, make directory nav links work on file page

ec91a0a6fb00a4ac5162093c3c8b372fc2475123

Tucker McKnight | Sun Dec 21 2025

Make themes work, some color tweaks, make directory nav links work on file page
frontend/main.js:1
Before
1
import {branchesListItems} from '../dist/js_templates/common/htmlPage.js'
After
1
import branchesListItems from '../dist/js_templates/common/branchesListItems.js'
frontend/top.js:16
Before
16
17
18
19
20
  // window['currentTheme'] = localStorage.getItem("theme") || "auto"
  window['currentTheme'] = "light"
      element.innerHTML = `<i class=&quot;bi bi-brightness-high&quot;>;</i>`
      element.innerHTML = `<i class=&quot;bi bi-moon&quot;>;</i>`
      element.innerHTML = `<i class=&quot;bi bi-yin-yang&quot;&gt;</i>`
After
16
17
18
19
20
  window['currentTheme'] = localStorage.getItem("theme") || "auto"
      element.innerHTML = `<span&gt;&amp;#x1F4A1;</span>`
      element.innerHTML = `<span&gt;&amp;#x1F319;</span>`
      element.innerHTML = `<span&gt;&amp;#x1F5A5;&amp;#xFE0F;</span>`
js_templates/common/branchesListItems.ts:0
Before
0
After
0
export default (branches: Array<{name: string, href: string, date: string}>, defaultBranch: string, currentBranch: string): string => {
  return branches.map((branch) => {
    const currentBadge = currentBranch === branch.name ? '<div class="badge rounded-pill bg-primary mx-1">current</div>' : ''
    const defaultBadge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-info text-dark mx-1">default</div>' : ''

    return `<a href='${branch.href}' class='dropdown-item my-1'><span class="branch-dropdown-branch-name me-1">${branch.name}</span>${currentBadge}${defaultBadge}<span class="text-body d-block ms-2">updated ${branch.date}</span></a>`
  }).join('')
}
js_templates/common/htmlPage.ts:1
Before
1
2
3
4
5
6
7
8
9

export const branchesListItems = (branches: Array&lt;{name: string, href: string, date: string}>, defaultBranch: string, currentBranch: string): string => {
  return branches.map((branch) => {
    const currentBadge = currentBranch === branch.name ? &#39;<div class="badge rounded-pill bg-primary mx-1">current</div>' : ''
    const defaultBadge = defaultBranch === branch.name ? '<div class="badge rounded-pill bg-info text-body mx-1">default</div>' : ''

    return `<a href='${branch.href}' class='dropdown-item my-1'><span class="branch-dropdown-branch-name me-1">${branch.name}</span>${currentBadge}${defaultBadge}<span class="text-body d-block ms-2">updated ${branch.date}</span></a>`
  }).join('')
}
After
1
2
3
4
5
6
7
8
9
import branchesListItems from './branchesListItems.ts'
    // this still necessary?
js_templates/common/htmlPage.ts:26
Before
26
        href: nav.repoBranchHome(branch.name),
After
26
        href: nav.repoBranchHome(branch.name) + '/' + data.nav.path,
js_templates/common/htmlPage.ts:39
Before
39
          <link href="https://unpkg.com/prismjs@1.20.0/themes/prism.css" rel="stylesheet" />
After
39
js_templates/common/htmlPage.ts:47
Before
47
After
47
          <link rel="stylesheet" id="prism-theme" type="text/css" href="${data.reposPath}/vendor/prism.css" />
js_templates/common/htmlPage.ts:63
Before
63
                        <button class="branches nav-link d-inline-block btn dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
After
63
                        <button class="branches nav-link d-inline-block btn btn-bg dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
js_templates/common/htmlPage.ts:101
Before
101
After
101
              <div class="col-auto d-flex align-items-center">
                <div class="dropdown">
                  <button class="dropdown-toggle btn shadow-none" id="dark-mode-switch" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                    <span>&#xFE0F;</span>
                  </button>
                  <ul class="dropdown-menu">
                    <li><button class="btn shadow-none" data-theme-pref="light" onclick="toggleDarkMode(this)"><span class="me-1">&#x1F4A1;</span>Light</button></li>
                    <li><button class="btn shadow-none" data-theme-pref="dark" onclick="toggleDarkMode(this)"><span class="me-1">&#x1F319;</span>Dark</button></li>
                    <li><button class="btn shadow-none" data-theme-pref="auto" onclick="toggleDarkMode(this)"><span class="me-1">&#x1F5A5;&#xFE0F;</span>Match OS</button></li>
                  </ul>
                </div>
              </div>
js_templates/file.ts:14
Before
14
15
          <span class="bezel-gray px-1"><a href="#">&#x1F3E0; ./</a></span>${
                return `<span class="bezel-gray px-1"><a href="#">${dir}</a></span>`
After
14
15
          <span class="bezel-gray px-1"><a href="${data.reposPath}/${data.fileInfo.repoName}/branches/${data.fileInfo.branchName}/files">&#x1F3E0; ./</a></span>${
                return `<span class="bezel-gray px-1"><a href="${data.reposPath}/${data.fileInfo.repoName}/branches/${data.fileInfo.branchName}/files/${arr.slice(0, index + 1).join(&#39;/&#39;)}&quot;>${dir}</a></span>`
js_templates/file.ts:39
Before
39
              <a href="${data.reposPath}/${slugify(data.fileInfo.repoName)}/branches/${slugify(data.fileInfo.branchName)}/files/${slugify(dir.fullPath)}.html">${getRelativePath(data.fileInfo.file, dir.name)}</a>
After
39
              <a href="${data.reposPath}/${slugify(data.fileInfo.repoName)}/branches/${slugify(data.fileInfo.branchName)}/files/${dir.fullPath.split('/').map((pathPart) =&gt; slugify(pathPart)).join('/')}&quot;>${getRelativePath(data.fileInfo.file, dir.name)}</a>
js_templates/files.ts:25
Before
25
            <a href="${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${slugify(file.fullPath)}.html">${file.name}</a>
After
25
            <a href="${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${file.fullPath.split('/').map((pathPart) =&gt; slugify(pathPart)).join('/')}&quot;>${file.name}</a>
main.ts:310
Before
310
311
        return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/files/${eleventyConfig.getFilter("slugify")(data.fileInfo.file)}.html`
          path: &quot;files&quot;,
After
310
311
        return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/files/${data.fileInfo.file.split('/').map((filePart) => eleventyConfig.getFilter("slugify")(filePart)).join('/')}/`
          path: &#39;files&#39;,
main.ts:405
Before
405
          path: &quot;&quot;,
After
405
          path: (data) =&gt; &#39;', // ask about why empty string here shows up as a function
main.ts:444
Before
444
          path: &quot;patches/page1&quot;,
After
444
          path: &#39;patches/page1&#39;,
main.ts:481
Before
481
          path: &quot;patches/page1&quot;,
After
481
          path: &#39;patches/page1&#39;,
scss/custom.scss:1
Before
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@use 'sass:color';

$body-color: #262626;

$font-family-base: serif;

$border-radius: 0;
$border-radius-sm: 0;
$border-radius-lg: 0;

$enable-transitions: false;

$gray: #EFF2E4;
$blue: #7388FA;
$lightblue: #73B2FA;
$purple: #B673FA;
$magenta: #E273FA;
$teal: #80F8D4;

$body-bg: $gray;
$primary: $blue;
$info: $teal;
$warning: $magenta;

$body-tertiary-bg: color.adjust($gray, $lightness: -5%);

$border-color: $lightblue;
$border-width: 2px;

@import "../node_modules/bootstrap/scss/bootstrap";


.bezel {
  background-color: $blue;
  border-top: 6px solid color.adjust($blue, $lightness: 15%);
  border-left: 6px solid color.adjust($blue, $lightness: 13%);
  border-bottom: 6px solid color.adjust($blue, $lightness: -10%);
  border-right: 6px solid color.adjust($blue, $lightness: -13%);
}

.bezel-purple {
  background-color: $purple;
  border-top: 6px solid color.adjust($purple, $lightness: 15%);
  border-left: 6px solid color.adjust($purple, $lightness: 13%);
  border-bottom: 6px solid color.adjust($purple, $lightness: -10%);
  border-right: 6px solid color.adjust($purple, $lightness: -13%);
}

.bezel-gray {
  background-color: $gray;
  border-top: 6px solid color.adjust($gray, $lightness: 15%);
  border-left: 6px solid color.adjust($gray, $lightness: 13%);
  border-bottom: 6px solid color.adjust($gray, $lightness: -10%);
  border-right: 6px solid color.adjust($gray, $lightness: -13%);
}

.bezel-inset {
  background-color: $gray;
  border-bottom: 6px solid color.adjust($gray, $lightness: 15%);
  border-right: 6px solid color.adjust($gray, $lightness: 13%);
  border-top: 6px solid color.adjust($gray, $lightness: -10%);
  border-left: 6px solid color.adjust($gray, $lightness: -13%);
}

.bezel-inset-purple {
  background-color: $purple;
  border-bottom: 6px solid color.adjust($purple, $lightness: 15%);
  border-right: 6px solid color.adjust($purple, $lightness: 13%);
  border-top: 6px solid color.adjust($purple, $lightness: -10%);
  border-left: 6px solid color.adjust($purple, $lightness: -13%);
}

.no-right {
  border-right: none !important;
}

.no-left {
  border-left: none !important;
}

a {
  color: $teal;
}
.btn {
  font-family: sans-serif;
  box-shadow: rgba(0, 0, 0, .6) 4px 6px;
}

.btn:hover:not(.shadow-none) {
  transform: translateX(2px) translateY(4px);
  box-shadow: rgba(0, 0, 0, 1) 2px 2px;
}

.btn:active:not(.shadow-none) {
  transform: translateX(3px) translateY(5px);
  box-shadow: rgba(0, 0, 0, 1) 1px 1px;
}

h1.blue {
  color: $blue;
}

nav a, nav span {
  font-family: sans-serif;
}
.nav-item a {
  color: $purple;
}

.navbar-nav .nav-link.active {
  background-color: $purple;
  color: white;
}
After
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
scss/design-board.scss:20
Before
20
After
20
$secondary: $purple;
scss/design-board.scss:43
Before
43
After
43
#dark-mode-switch span {
  text-shadow: 0 0 12px $black;
}

@include color-mode(dark) {
  $blue: #354BC6;

  .bezel {
    background-color: $blue;
    border-top: 6px solid color.adjust($blue, $lightness: 10%);
    border-left: 6px solid color.adjust($blue, $lightness: 7%);
    border-bottom: 6px solid color.adjust($blue, $lightness: -15%);
    border-right: 6px solid color.adjust($blue, $lightness: -18%);
  }

  .nav-item a {
    color: $lightblue;
  }

  .btn-bg {
    background-color: color.adjust($body-bg-dark, $lightness: 10%);
  }

  .list-group {
    --bs-list-group-border-color: #404448;
  }

  .bezel-gray {
    background-color: color.adjust($body-bg-dark, $lightness: 10%);
    border-top: 6px solid color.adjust($body-bg-dark, $lightness: 15%);
    border-left: 6px solid color.adjust($body-bg-dark, $lightness: 13%);
    border-bottom: 6px solid color.adjust($body-bg-dark, $lightness: -5%);
    border-right: 6px solid color.adjust($body-bg-dark, $lightness: -9%);
  }

  #dark-mode-switch span {
    text-shadow: 0 0 12px $white;
  }
}
scss/design-board.scss:52
Before
52
53
54
55
56
  background-color: $gray;
  border-top: 6px solid color.adjust($gray, $lightness: 15%);
  border-left: 6px solid color.adjust($gray, $lightness: 13%);
  border-bottom: 6px solid color.adjust($gray, $lightness: -10%);
  border-right: 6px solid color.adjust($gray, $lightness: -13%);
After
52
53
54
55
56
  border-top: 6px solid color.adjust($body-bg, $lightness: 15%);
  border-left: 6px solid color.adjust($body-bg, $lightness: 13%);
  border-bottom: 6px solid color.adjust($body-bg, $lightness: -10%);
  border-right: 6px solid color.adjust($body-bg, $lightness: -13%);
scss/design-board.scss:83
Before
83
84
85
a {
  color: $blue;
}
After
83
84
85
$link-color: $blue;
$link-color-dark: $lightblue;