Skip to content

Instantly share code, notes, and snippets.

@elkadre
Last active January 20, 2025 10:35
Show Gist options
  • Save elkadre/bd55c63884ad70d5ba5055b1844b7124 to your computer and use it in GitHub Desktop.
Save elkadre/bd55c63884ad70d5ba5055b1844b7124 to your computer and use it in GitHub Desktop.
daily notes callouts
/* DAILY CALLOUT */
.theme-light, .theme-dark {
--daily-callout-container-shadow: none;
--daily-callout-title-shadow: none;
--daily-callout-content-shadow: none;
--daily-callout-color: var(--color-gray-rgb);
--daily-callout-color-one-rgb: var(--color-pink-rgb);
--daily-callout-color-two-rgb: var(--color-blue-rgb);
--daily-callout-radius: 10px;
}
.callout[data-callout="daily"] {
--callout-icon: coffee;
--callout-color: var(--daily-callout-color);
background-color: transparent;
padding: 0px;
box-shadow: var(--daily-callout-container-shadow);
border-radius: var(--daily-callout-radius);
}
.callout[data-callout="daily"] .callout-icon {
opacity: 1 /* set to zero if you don't want the icon */
}
.callout[data-callout="daily"] .callout-title {
background: linear-gradient(90deg, rgba(var(--daily-callout-color-one-rgb), .1) 0%, rgba(var(--daily-callout-color-two-rgb), .1) 100%);
padding: 10px;
border: none;
box-shadow: var(--daily-callout-title-shadow);
border-radius: var(--daily-callout-radius);
}
.callout[data-callout="daily"] .callout-title-inner {
text-align: center !important; /* remove if you don't want a centered title */
margin:auto;
}
.callout[data-callout="daily"] .callout-content {
columns: 2; /* remove if you don't want two columns */
padding: 10px;
box-shadow: var(--daily-callout-content-shadow);
border-radius: var(--daily-callout-radius);
}
.callout[data-callout="daily"] .callout-content>*:first-child {
margin-top: 0px !important;
}
.callout[data-callout="daily"] ul > li {
margin-top: 0px !important;
margin-bottom: 5px !important;
}
.callout[data-callout="daily"] .callout-content>*:last-child {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
/* TAG PILLS BASED ON PRIMARY THEME
https://github.com/primary-theme/obsidian
the tags need to be in a list to be formatted */
.theme-light, .theme-dark {
--pill-tag-color-1: rgba(var(--color-yellow-rgb), 1);
--pill-tag-bg-1: rgba(var(--color-yellow-rgb), .1);
--pill-tag-color-2: rgba(var(--color-red-rgb), 1);
--pill-tag-bg-2: rgba(var(--color-red-rgb), .1);
--pill-tag-color-3: rgba(var(--color-blue-rgb), 1);
--pill-tag-bg-3: rgba(var(--color-blue-rgb), .1);
--pill-tag-shadow-hover: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.05);
}
.callout[data-callout="daily"] li::marker { /* makes list marker transparent in the callout */
color:transparent
}
.callout[data-callout="daily"] li { /* removes list indent from callout */
padding-inline-start: 0px
}
li a.tag {
font-weight: normal;
box-shadow: none;
text-decoration: none;
transition: var(--anim-duration-superfast) var(--anim-motion-smooth);
border:none
}
li a.tag:hover {
box-shadow: var(--pill-tag-shadow-hover);
}
li:nth-child(3n+1) a.tag {
color: var(--pill-tag-color-1);
background: var(--pill-tag-bg-1)
}
li:nth-child(3n+2) a.tag {
color: var(--pill-tag-color-2);
background: var(--pill-tag-bg-2)
}
li:nth-child(3n+3) a.tag {
color: var(--pill-tag-color-3);
background: var(--pill-tag-bg-3)
}
/* INLINE DATAVIEW FIELS FROM MINIMAL THEME
https://github.com/kepano/obsidian-minimal/ */
body .dataview.inline-field-key,
body .dataview.inline-field-value,
body .dataview .inline-field-standalone-value {
font-family: var(--font-text);
font-size: calc(var(--font-adaptive-normal) - 2px);
background: transparent;
color: var(--text-muted);
}
body .dataview.inline-field-key {
padding: 0;
}
body .dataview .inline-field-standalone-value {
padding: 0;
}
body .dataview.inline-field-key::after {
margin-left: 3px;
content: "|";
color: var(--background-modifier-border);
}
body .dataview.inline-field-value {
padding: 0 1px 0 3px;
}
body .dataview.inline-field-key, body .dataview.inline-field-value, body .dataview .inline-field-standalone-value {
font-family: var(--font-text);
font-size: var(--font-smaller);
background: transparent;
color: var(--text-muted);
}
@elkadre
Copy link
Author

elkadre commented Oct 15, 2024

Dataview Query

dataview
TABLE WITHOUT ID
  file.link as date, 
  item.text as update
FROM "Daily Notes"
FLATTEN file.lists as item
WHERE icontains(item.text, "#mood")
WHERE !item.task 
SORT date desc
LIMIT 1 

Breakdown of Query

  1. TABLE WITHOUT ID file.link as date, item.text as update these are the table headers and can be anything you like, even a link, for example item.text as "[[mood]]"
  2. FROM "Daily Notes" sets the scope of the query
  3. FLATTEN file.lists as item searches the list items in the files
  4. WHERE icontains(item.text, "#mood") insert keyword(s)
  5. WHERE !item.task shows only list items that are not tasks
  6. SORT date desc basic sorting
  7. LIMIT 1 this would limit the search to only the latest update

Full Dataview Plugin documentation is found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment