# How to make note after checked checklist have a faded colour?

**URL:** <https://forum.obsidian.md/t/how-to-make-note-after-checked-checklist-have-a-faded-colour/74206>\
**Category:** Devs: Theme Design & Custom CSS\
**Tags:** custom-css, checkbox\
**Created:** [January 4, 2024, 4:14am UTC](https://forum.obsidian.md/t/how-to-make-note-after-checked-checklist-have-a-faded-colour/74206 "2024-01-04T04:14:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![67Samuel](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/6/51bf81/32.png) [@67Samuel](https://forum.obsidian.md/u/67Samuel)\
**Post date:** [January 4, 2024, 4:14am UTC](https://forum.obsidian.md/t/how-to-make-note-after-checked-checklist-have-a-faded-colour/74206/1 "2024-01-04T04:14:37Z")

</div>

### What I’m trying to do

Here is what my checklists currently look like:

 ![image](https://forum.obsidian.md/uploads/default/original/3X/1/c/1cd6c332f550d52a0db37d68df995a29ce7ac196.png)

I want the notes below ‘task 1’ to be faded out too.

### Things I have tried

I’ve looked at this related feature request [Don’t strike through nested checkboxes when outer checkbox is checked - Feature requests - Obsidian Forum](https://forum.obsidian.md/t/dont-strike-through-nested-checkboxes-when-outer-checkbox-is-checked/8389), but it doesn’t seem to work for my version (v1.5.3), and I’m not very familiar with css anyway so I’m unable to edit it to my liking.

---

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [January 25, 2024, 8:56pm UTC](https://forum.obsidian.md/t/how-to-make-note-after-checked-checklist-have-a-faded-colour/74206/2 "2024-01-25T20:56:11Z")

</div>

Are you in _live preview_ or _reading mode_ ? I’m guessing _live preview_ as when I add the strikethrough option on completed tasks using _Minimal_ theme I only get the first line styled, and not the second. (Even though in a query both the lines are styled… In _reading mode_ the entire task is styled as expected.

## Naive approach with general siblings

If you’re in _live preview_ then the matters becomes that on how to _also_ include the following lines after a completed task line. In my simplistic tests this selector seemed to do the trick, and I don’t know the exact styling for your faded look, so our first attempt looks like:

```css
.HyperMD-task-line[data-task="x"] ~ .HyperMD-list-line-nobullet {
  /* background-color: #102060; /* */
  color: var(--text-faint);
}

```

If you remove the first `/*` the matching text selection should get a deep blue background color, which I used to check my matching. And sadly that turned out to _also_ target any other text related to another task.

## Alt II: Duplicate the next sibling selector

In the snippet above I used the generic sibling selector, `~`, but since _live preview_ places almost all div’s on the same level, they’re also all generic siblings. Bummer. However, there is a more specific next sibling selector, `+`, which only targets the immediate sibling. So if we just replace that in the CSS above it would select the completed task’s _immediate_ line. However, if we need to have multiple lines, we need to duplicate that pattern (as far as I know), and then we end up with something like:

```css
.HyperMD-task-line[data-task="x"], 
.HyperMD-task-line[data-task="x"] + .HyperMD-list-line-nobullet,
.HyperMD-task-line[data-task="x"] + .HyperMD-list-line-nobullet + .HyperMD-list-line-nobullet
 {
   background-color: #102060; /* */
  color: var(--text-faint);
}

```

And this pattern needs to be repeated ad nauseam… But it do work as intended for as many note line as you specify it for… In the CSS above I’ve also included the line with the task itself.

## Alt III: CSS magic

I wasn’t satisfied yet, so I went on another round of googling, and came across [this Stack Overflow answer](https://stackoverflow.com/a/14408061/1548472), where they do something similar. The gist of the idea as I see it, is that we’ve got three groups of selectors to combine:

- Completed task followed by a single note line
- Completed task followed by a combination of note lines
- Completed task followed by another task followed by any note lines

The two first we want to style, and the last one is the reset style back to normal for following items. In our case the CSS from the above answer looks like:

```css
.HyperMD-task-line[data-task="x"], 
.HyperMD-task-line[data-task="x"] + .HyperMD-list-line-nobullet,
.HyperMD-task-line[data-task="x"] ~ .HyperMD-list-line-nobullet + .HyperMD-list-line-nobullet {
  background-color: #102060;
  color: var(--text-faint);
}

.HyperMD-task-line[data-task="x"] ~ *:not(.HyperMD-list-line-nobullet) ~ .HyperMD-list-line-nobullet {
  background-color: inherit;
  color: inherit;
}

```

So now all you need to do is find out how is your text styled to get that faded look, copy that into CSS similar to that above, and remember to reset the style settings you change in the last block.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [April 24, 2024, 8:56pm UTC](https://forum.obsidian.md/t/how-to-make-note-after-checked-checklist-have-a-faded-colour/74206/3 "2024-04-24T20:56:47Z")

</div>

Closed on April 24, 2024, 8:56pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
