Sorry a little late, but my brain was out of commission for the weekend so I only finished my solution now, but good to see that Charlie could help you already.
Still if you are interested: I used two macros working with the given
titles/tags to make it more modular so it can be extended in the future.
The only thing I have yet to work out is different combinations for the
same colour.
The first and simpler macro is used to get the colours needed to mix the
colour:
\define get-combination()
<$list filter="[!has[draft.of]tag<currentTiddler>sort[title]first[]]">
<$link to=<<currentTiddler>> />
</$list>
<$list filter="[!has[draft.of]tag<currentTiddler>sort[title]butfirst[]]">
+ <$link to=<<currentTiddler>> />
</$list>
\end
The only difference between the filters is that the first only uses the
first result and the second uses the rest to get the formatting of 'colour
+ colour' with as many '+ colour' as needed for the current combination.
So the filter in detail:
1. *!has[draft.of]* just makes sure that only tiddlers not currently
edited are used.
2. *tag<currentTiddler>* looks for tiddlers that are tagged with the
title of the tiddler the macro is called in. For instance if you call the
macro in a tiddler called 'Orange' it will look if there are tiddlers
tagged 'Orange'.
3. *sort[title]* sorts the resulting list by the tiddlers titles.
4. *first[]* then discards everything except for the first title in the
list and *butfirst[]* does the opposite and takes the rest.
The second macro that is used to get all combinations with a specific
colour:
\define get-color-combinations()
<$list filter="[<currentTiddler>tags[]]" variable="tag">
<$list filter="[<tag>tag[Mixed Color]]" variable="mixed-color">
<<currentTiddler>>
<$list filter="[!has[draft.of]tag<mixed-color>!<currentTiddler>]" variable=
"other-color">
+ <$link to=<<other-color>> />
</$list>
= <$link to=<<mixed-color>> />
<br />
</$list>
</$list>
\end
And the details:
1. The first list just gets all the tiddlers of the currentTiddler and
puts it in a variable called *tag* as to not overwrite currentTiddler.
2. The second list filters for mixed colors related to the
currentTiddler.
1. *<tag>* is just a shortform of title<tag> and looks for a tiddler
that is named the same as the value of the tag variable.
2. *tag[Mixed Color]* then looks if the tiddler it found has the tag
'Mixed Color'.
3. the result gets put into a variable called *mixed-color* once
again so currentTiddler isn't overwritten.
3. Then the title of the current tiddler is 'printed' as the first part
of the final text. This is not a link as this is the currently used tiddler.
4. The third list then looks for the other colour/colours that are
tagged with the current mixed-color.
1. *!has[draft.of]* once again making sure only tiddlers not being
edited get used.
2. *tag<mixed-color>* looks for tiddlers tagged with the value of
mixed-color.
3. *!<currentTiddler>* but only take those that aren't the
current-tiddler.
4. and another variable this time called *other-color*.
5. Now print each found colour with '+ other-color' to create the second
part of the result. These are all links to their respective tiddlers.
6. And finally when the previous list is finished with adding colours
add '= mixed-color' plus a line-break as the third and last part of the
result. Once again this is a link to the tiddler.
The first macro can be used both in tiddler with a mixed colour and in a
general combination overview like so:
<$list filter="[!has[draft.of]tag[Mixed Color]sort[title]]" >
<$link to=<<currentTiddler>> />:
<<get-combination>>
<br />
</$list>
The second macro can be used in any colour tiddler that is part of a mixed
colour both basic colour and mixed colour.
And because this reply is not long enough already here a few screenshots:
Tiddler 'Red' with <<get-color-combinations>> in use also showing a
combination from three colours:
Tiddler 'Green' showing the colours needed to mix it via
<<get-combination>>:
The overview tiddler of possible combinations:
And a version of the Violet Tiddler that uses both macors:
I attached a json file for easy import should you want to use it/play
around with it.
Also I second Charlie in that I would love to see whatever the end result
might be.
Kind Regards,
Felicia
On Tuesday, 13 October 2020 17:45:04 UTC+2, [email protected] wrote:
>
> Hello,
>
> Tiddlers a + b are tagged with tiddler 1.
> Tiddlers a + c + d are tagged with tiddler 2.
> Tiddlers a + b + c + d are tagged with (Ip).
>
> In tiddler (Ip), I want to show ALL letter combinations: (transclude
> tiddler titles as a link)
> POSSIBLE COMBINATIONS:
> a + b → tiddler 1
> a + c + d → tiddler 2
>
> In tiddler a, I want to show all letter combinations with tiddler a:
> (transclude tiddler titles as a link)
> POSSIBLE COMBINATIONS:
> a + b → tiddler 1
> a + c + d → tiddler 2
>
> In tiddler b, I want to show all letter combinations with tiddler b:
> (transclude tiddler titles as a link)
> POSSIBLE COMBINATIONS:
> b + a → tiddler 2
>
> In tiddler 1, I want to show the letter combination: (transclude textfield
> of tiddlers)
> a + b
>
> In tiddler 2, I want to show the letter combination: (transclude textfield
> of tiddlers)
> a + c + d
>
> Many thanks,
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/d1002a27-6989-4494-8a04-88be303a5e22o%40googlegroups.com.
color-macros.json
Description: application/json

