Is it possible to filter blocks based on colors?

or use queries with color based conditions?
I have been a user of workflowy and this feature is there so looking for something similar.

maybe you can try something like this:

#+BEGIN_QUERY
{:title [:h3 "red in current page"]
:query (and (page <% current page %>) "red")
}
#+END_QUERY
1 Like

“red” gives the results with block in red color but also blocks with the word red in them :frowning:

maybe use a tag such as #red and customize the way it is displayed in custom.css? a query for the #red tag should produce what you need then.

yeah that would be a workaround not a solution. i would rather give up on using colours if it is so difficult.

I am surprised though that advanced tool like logseq not having a feature to filter by color.

sure if only query for keyword “red”, the result would include red.

but you can expand the keyword, for me, the colored blocks occur in 2 cases: pdf and epub annotatiion.

for pdf, the keyword is “hl-color:: red”
for epub, the keyword is “calibreViewer, red”

you can replace the “red” with these keywords

{{query "calibreViewer, red"}}
{{query "hl-color:: red"}}

for colored blocks in current page, you can try

#+BEGIN_QUERY
{:title [:h3 "red in current page"]
:query (and (page <% current page %>) "calibreViewer, red")
}
#+END_QUERY

i am confused. i am not having any pdf or epub file. i am looking for a solution for nomal blocks that have been colored using the default feature of right clicking and choosing from the colors available.

also i am curious, i why does it have h3 in the code? because none of my blocks are heading 3. is it something related to the color just above the heading number? if so, the color above h3 is pink, not red.

also, I copy pasted your text it gives out nothing. the screenshot is when I am NOT in editing mode.

pls leave my example text, it was based on pdf & epub, and it would not give out anything in your case.

if you are using right click choose pink, then this may work

{{query "background-color:: pink"}}

you can check the color from the journal md file, then replace the above “pink” with other color

2 Likes

worked. thank you.
…