Skip to content

Commit

Permalink
Add further theming options (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
das-kaesebrot authored Feb 17, 2025
1 parent 8a82ec4 commit 1a3f40d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 12 deletions.
Binary file modified assets/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 63 additions & 8 deletions lib.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "@preview/fontawesome:0.5.0": *

#let _cv-line(left, right, ..args) = {
set block(below: 0pt)
set block(below: 0pt, above: 1pt)
table(
columns: (1fr, 5fr),
stroke: none,
Expand All @@ -11,28 +11,53 @@
)
}
#let moderncv-blue = rgb("#3973AF")
#let light-gray = rgb("#737373")

#let _header(
title: [],
subtitle: [],
image: none,
image-frame-stroke: auto,
color: moderncv-blue,
subtitle-color: light-gray,
socials-color: light-gray,
emphasize: false,
socials: (:),
) = {
let subtitle-emphasis = "normal"
if emphasize {
subtitle-emphasis = "italic"
}

let titleStack = stack(
dir: ttb,
spacing: 1em,
text(size: 30pt, title),
text(size: 20pt, subtitle),
text(size: 20pt, subtitle, style: subtitle-emphasis, fill: subtitle-color),
)

let social(icon, link_prefix, username) = [
#fa-icon(icon) #link(link_prefix + username)[#username]
#if emphasize [
#emph[#text(socials-color)[#fa-icon(icon) #link(link_prefix + username)[#username]]]
] else [
#text(socials-color)[#fa-icon(icon) #link(link_prefix + username)[#username]]
]
]

let custom-social(icon, dest, body) = [
#fa-icon(icon) #link(dest, body)
#if emphasize [
#emph[#text(socials-color)[#fa-icon(icon) #link(dest, body)]]
] else [
#text(socials-color)[#fa-icon(icon) #link(dest, body)]
]
]

let address-social(icon, body) = [
#if emphasize [
#emph[#text(socials-color)[#fa-icon(icon) #body]]
] else [
#text(socials-color)[#fa-icon(icon) #body]
]
]

let socialsDict = (
Expand All @@ -51,11 +76,15 @@
assert(entry.len() == 2, message: "Invalid social entry length.")
let (key, value) = entry
if type(value) == str {
if key not in socialsDict {
panic("Unknown social key: " + key)
if (key == "address") {
socialsList.push(address-social("house", value))
} else {
if key not in socialsDict {
panic("Unknown social key: " + key)
}
let (icon, linkPrefix) = socialsDict.at(key)
socialsList.push(social(icon, linkPrefix, value))
}
let (icon, linkPrefix) = socialsDict.at(key)
socialsList.push(social(icon, linkPrefix, value))
} else if type(value) == array {
assert(value.len() == 3, message: "Invalid social entry: " + key)
let (icon, dest, body) = value
Expand Down Expand Up @@ -124,6 +153,9 @@
subtitle: [CV],
social: (:),
color: moderncv-blue,
subtitle-color: light-gray,
socials-color: light-gray,
emphasize-header: false,
lang: "en",
font: "New Computer Modern",
image: none,
Expand Down Expand Up @@ -172,7 +204,10 @@
image: image,
image-frame-stroke: image-frame-stroke,
color: color,
subtitle-color: subtitle-color,
socials-color: socials-color,
socials: social,
emphasize: emphasize-header,
)

#body
Expand Down Expand Up @@ -208,6 +243,26 @@
)
}
#let cv-entry-multiline(
date: [],
title: [],
employer: [],
..description,
) = {
let elements = (
strong(title),
emph(employer),
..description.pos(),
)
cv-line(
date,
elements.slice(0, -1).join(", ") + linebreak() + text(
size: 0.9em,
elements.at(-1),
),
)
}
#let cv-language(name: [], level: [], comment: []) = {
_cv-line(
align(right, name),
Expand Down
9 changes: 5 additions & 4 deletions template/cv.typ
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// custom socials: (icon, link, body)
// any fontawesome icon can be used: https://fontawesome.com/search
website: ("link", "https://example.me", "example.me"),
address: "Test Street 1, 12345 Example City",
),
)

Expand All @@ -29,17 +30,17 @@

= Experience

#cv-entry(
#cv-entry-multiline(
date: [4/2022 -- 7/2023],
employer: [The Snake Company],
title: [Snake Specialist],
[#linebreak()#text(10pt, lorem(30))],
[#text(10pt, lorem(30))],
)
#cv-entry(
#cv-entry-multiline(
date: [4/2022 -- 7/2023],
employer: [Viper Ventures],
title: [Working Student],
[#linebreak()#text(10pt, lorem(30))],
[#text(10pt, lorem(30))],
)

= Programming Skills
Expand Down

0 comments on commit 1a3f40d

Please sign in to comment.