Skip to content

✨ Hereford Theme #43

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 30 additions & 0 deletions themes/hereford/colors.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// TODO: these names are terrible, fix them
#let dark-red = rgb("#e05c4a")
#let light-dark-red = rgb("#f86f5d")


#let red = rgb("#e06666")
#let light-red = rgb("#ea9999")
#let orange = rgb("#f6b26b")
#let light-orange = rgb("#fce5cd")
#let yellow = rgb("#ffd966")
#let light-yellow = rgb("#fff2cc")
#let green = rgb("#93c47d")
#let light-green = rgb("#d9ead3")
#let blue = rgb("#6d9eeb")
#let light-blue = rgb("#c9daf8")
#let purple = rgb("#c4b0ff")
#let light-purple = rgb("#ede5ff")
#let pink = rgb("#d5a6bd")
#let light-pink = rgb("#ead1dc")
#let brown = rgb("#ca9994")
#let light-brown = rgb("#deafab")
#let gray = rgb("#999999")
#let light-gray = rgb("#b7b7b7")

#let pro-green = rgb("#a5f1a3")
#let con-red = rgb("#ff9999")

#let surface-0 = rgb("#d9d9d9")
#let surface-1 = rgb("#cccccc")
#let surface-3 = rgb("#eeeeee")
4 changes: 4 additions & 0 deletions themes/hereford/components/components.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import "./decision-matrix.typ": *
#import "pro-con.typ": *
#import "./toc.typ": *
#import "glossary.typ": *
140 changes: 140 additions & 0 deletions themes/hereford/components/decision-matrix.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#import "/utils.typ"
#import "../colors.typ": *

#let decision-matrix(
properties: none,
..choices,
) = {
let data = utils.calc-decision-matrix(
properties: properties,
..choices,
)

//repr(data)

let winning-column
for (
index,
result,
) in data.enumerate() {
if result.values.total.highest == true {
winning-column = index + 2
break
}
}

let table-height = properties.len() + 2
let table-length = choices.pos().len() + 2

import table: hline, vline, cell
show cell: it => {
set align(center + horizon)
box(
height: 30pt,
it,
)
}
table(
columns: for _ in range(choices.pos().len() + 2) {
(
1fr,
)
},
stroke: none,
fill: (
x,
y,
) => {
if y == 0 or (
x == 0 and not y == properties.len() + 1
) {
yellow.lighten(50%)
}

if x == winning-column and not y == 0 {yellow.lighten(50%)}
},

// we make lines

vline(stroke: yellow, end: table-height - 1),
hline(stroke: yellow),

..for num in range(0, table-height) {
let stroke = if num < 2 {yellow} else {gray}
(hline(y: num, stroke: stroke, start: 2),)
},

hline(stroke: gray, y: table-height, start: 1),

..for num in range(1, table-height + 2) {
(
vline(x: num, stroke: yellow, start: 0, end: 1),
vline(x: num, stroke: gray, start: 1),
)
},

// outline the properties
..for num in range(0, table-height) {
(hline(y: num, stroke: yellow, start: 0, end: 1),)
},



// outline the weights
hline(stroke: pro-green, start: 1, end: 2),
hline(y: table-height - 1, stroke: pro-green, start: 1, end: 2),
vline(x: 1, stroke: pro-green, end: table-height - 1),
vline(x: 2, stroke: pro-green, end: table-height - 1),

..for num in range(0, table-height) {
(hline(y: num, stroke: pro-green, start: 1, end: 2),)
},


// outline the best choice
hline(start: winning-column, end: winning-column + 1, stroke: yellow),
vline(x: winning-column, stroke: yellow),
vline(x: winning-column + 1, stroke: yellow),
hline(y: table-height, start: winning-column, end: winning-column + 1, stroke: yellow),

..for num in range(0, table-height + 1) {
(hline(y: num, stroke: yellow, start: winning-column, end: winning-column + 1),)
},


// ok we're done making lines


[],
cell(fill: pro-green.lighten(50%))[*Weights*],
..for choice in choices.pos() {
(
[*#choice.at(0)*],
)
},
..for (
index,
property,
) in properties.enumerate() {
(
[*#property.name*],
table.cell(fill: pro-green.lighten(50%))[#property.weight],
..for result in data {
(
[#result.values.values().at(index).value],
)
},
)
},
[],
[*Totals:*],
..for (
index,
result,
) in data.enumerate() {
(
[#result.values.at("total").value],
)
},
)
}
1 change: 1 addition & 0 deletions themes/hereford/components/glossary.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#let glossary() = {}
59 changes: 59 additions & 0 deletions themes/hereford/components/pro-con.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#import "../colors.typ": *

#let pro-con(
pros: [],
cons: [],
) = {
show grid.cell.where(
y: 0,
x: 0,
): it => rect(
radius: 5pt,
width: 100%,
fill: pro-green,
it,
)
show grid.cell.where(
y: 0,
x: 1,
): it => rect(
radius: 5pt,
width: 100%,
fill: con-red,
it,
)

grid(
columns: (
1fr,
1fr,
),
gutter: 5pt,
inset: (
x,
y,
) => if y == 0 {
2pt
} else {
(
top: 10pt,
rest: 5pt,
)
},
row-gutter: -5pt,
fill: (
x,
y,
) => if y == 0 {
return
} else if x == 0 {
pro-green.lighten(50%)
} else if x == 1 {
con-red.lighten(50%)
},
align(center)[*Pros*],
align(center)[*Cons*],
pros,
cons,
)
}
35 changes: 35 additions & 0 deletions themes/hereford/components/toc.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import "/utils.typ"

#let toc() = utils.print-toc((
_,
body,
_,
) => {
set align(center)
let line = table.vline(stroke: gray)
table(
stroke: none,
columns: (
1fr,
1fr,
2fr,
1fr,
),
[*Page \#*],
line,
[*EDP Step*],
line,
[*Entry Description*],
line,
[*Date*],
line,
..for entry in body {
(
[#entry.page-number],
[#entry.type],
[#entry.title],
[#entry.date.display("[month]/[day]/[year]")],
)
},
)
})
Loading
Loading