primary-theme / obsidian

Comfy, playful but productive theme for Obsidian. "Primary instantly puts you in a relaxed state that opens the door to creativity and exploration. Wonderfully executed down to the smallest details,"
GNU General Public License v3.0
846 stars 38 forks source link

How to remove strikethrough from completed to-do lists/checkbox #161

Open mtisec opened 1 year ago

mtisec commented 1 year ago

Hi Cecilia, I freaking love your theme! It is pure perfection! ... with one thing I'd like to change. I wish I could remove the strikethrough from checked boxes. I tried multiple things. Among them was the snippet from https://github.com/Dmytro-Shulha/obsidian-css-snippets/blob/master/Snippets/Check%20box.md

/* Remove strikethrough from completed to-do lists/checkbox */  
.markdown-preview-view ul > li.task-list-item.is-checked {
    text-decoration: none;
    color: inherit;
}

It all doesn't work and I couldn't figure out yet, how the whole Obsidian CSS styling works. I have a bare minimum grasp of CSS, but that's all. I'd love to hear from you with an idea :)

PS: I think it would also be a perfect addition for Style Settings. I often create checklists that I want to export later for others and having my selections striked is really hard to read.

mtisec commented 1 year ago

I found the lines that disable strikethrough on hover of a checked box. It's line 2682-2685 in the current version of the theme.

.markdown-source-view .HyperMD-task-line:is([data-task=x], [data-task=X]):hover,
.task-list-item.is-checked:hover {
  text-decoration: unset;
}

and these lines - that seem to be from the original Obsidian CSS - seem to be responsible for the strikethrough:

.markdown-source-view.mod-cm6 .HyperMD-task-line[data-task="x"], .markdown-source-view.mod-cm6 .HyperMD-task-line[data-task="X"] {
    text-decoration: line-through;
    color: var(--text-faint);
}

I'll try overwriting them with a snippet now and come back here :)

mtisec commented 1 year ago

Works like a charm 🤩

Everything necessary was to add the following lines to a snippet and activate it:

/* Disable strike-through in markdown mode */
.markdown-source-view.mod-cm6 .HyperMD-task-line[data-task="x"], .markdown-source-view.mod-cm6 .HyperMD-task-line[data-task="X"] {
    text-decoration: unset;
    color: var(--text-faint);
}

/* Disable strike-through in preview mode */
ul > li.task-list-item[data-task="x"], ul > li.task-list-item[data-task="X"] {
    text-decoration: unset;
    color: var(--text-faint);
}

2022-09-13 19_53_38-Theme - Primary Demo File - Obsidian Vault - Obsidian v0 15 9

I am not sure if text-decoration: unset; is the logically best choice, but that's what hovering did. Trying now to add that to the Style Settings and creating a pull request ❤️

ceciliamay commented 2 months ago

Thank you so much for your contribution! I will be adding this to the Style Settings update after Primary 2.0 is launched.