Tag cloud using colors: idea and issues

127 views
Skip to first unread message

Atronoush

unread,
Jun 22, 2021, 7:58:30 AM6/22/21
to TiddlyWiki

There are some tag cloud tools around (e.g. Eric uses size and Mohammad use badge).
I like to have tag cloud based on color!

IDEA
i.  a macro to get a number and generate a color, I call it colgen
this is easy! in surface plots / contour plots we use color bars! here different color tables can be used in form of macro or dictionary tiddler

ii. a variable to calculate the number of tiddlers (e.g using $count) tagged with say foo

How it works
1. each time a new tiddler is tagged with foo the variable value is increased by one
2. this value is passed to colgen macro to generate color
3. this color is dynamically used for tag

you can use different color tables/bar for example red for high and blue for low (rainbow color table), ...


ISSUE
Tiddlywiki allow to use macros and transclusion in fields! BUT it seems it does not allow to change color dynamically!


I appreciate to have your idea, solution, codes, ...

--Atro

Charlie Veniot

unread,
Jun 22, 2021, 10:42:55 AM6/22/21
to TiddlyWiki
G'day Atro,

Try the following in a new Tiddler:

<$vars thisSecond=<<now ss>> >
<$vars rgbArg1={{{ [<thisSecond>multiply[3]]}}}
              rgbArg3={{{ [<thisSecond>multiply[5]]}}} >

<div style={{{ [[border:25px solid rgb(]addsuffix<rgbArg1>addsuffix[,]addsuffix<rgbArg1>addsuffix[,]addsuffix<rgbArg3>addsuffix[)]]  }}}>
Some Text
</div>

</$vars>
</$vars>


You'll need to do something to re-render the tiddler and see how colour changes over time.  (I just wanted a quick way to show how to have dynamic CSS styling using TiddlyWiki filtering.  So nothing fancy just for demonstration purposes.)

Charlie Veniot

unread,
Jun 22, 2021, 1:39:34 PM6/22/21
to TiddlyWiki
Arg, forgot to mention: quick way to re-render the tiddler (and update the color of the div element based on current time's seconds) is to  edit and cancel edit of the tiddler.

TiddlyTweeter

unread,
Jun 22, 2021, 2:05:58 PM6/22/21
to TiddlyWiki
It is certainly TRUE that everyone could benefit from a "CloudMap 101". 
IMO Eric's stuff on this is foundational. The man has a mind.

Color can be changed dynamically. It is just a value.
Cj.v gave a simple way. 
Though all those "{{{..}}}" are somewhat weird, but it wot we got to have.
.
TT

Charlie Veniot

unread,
Jun 22, 2021, 2:25:23 PM6/22/21
to TiddlyWiki
Is there some other way of getting the result of a filter that's less weird than using TiddlyWiki's triple curly brackets ?

I just threw that together quickly as an example re getting color "filterily(?)"  

It would be great to see some alternative approaches, I think.

TiddlyTweeter

unread,
Jun 22, 2021, 2:46:07 PM6/22/21
to TiddlyWiki
Ciao cj.v. I'm not sure, not being a programmer by trade. 

But even me, an average idiot, can see that having to wrap something {{{ [THINGIE] }}} is a seriously weird construct

I personally, on stuff like this, simply use simple substitution in style sheets. I seems fine without the brackets.

Best wishes
TT

Mohammad Rahmani

unread,
Jun 22, 2021, 2:54:11 PM6/22/21
to tiddl...@googlegroups.com
I think this is a bug! But maybe Jeremy or other developers can explain!
BUT the below code does not work for me!

<$button> Set Color
<$action-setfield $tiddler=testc $field=color $value=rgb(255,0,0)/>
</$button>


or
<$button> Set Color
<$action-setfield $tiddler=testc $field=color $value="yellow"/>
</$button>  



I appreciate to have your idea, solution, codes, ...

--Atro

--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8dfb1056-4081-4b77-8d82-18ad9bda7e42n%40googlegroups.com.

Mohammad Rahmani

unread,
Jun 22, 2021, 2:59:35 PM6/22/21
to tiddl...@googlegroups.com
Lets correct my previous post!

It seems the color is changed using

<$button> Set Color
<$action-setfield $tiddler=testc $field=color $value=rgb(255,0,0)/>
</$button>


But as the color field shows a color picker, it seems the color picker does not update!

Best wishes
Mohammad

Jeremy Ruston

unread,
Jun 22, 2021, 3:01:06 PM6/22/21
to tiddl...@googlegroups.com
The issue here is that JS macros are supposed to always return the same result when passed the same parameters (in computer science terms, JS macros are supposed to be deterministic).

It is possible to use JS macros that are non-deterministic, but they will cause the refresh mechanism to produce unexpected results.

I can't tell without understanding more about your code, but the solution may be refactoring the functionality as either a widget or a filter operator.

Best wishes

Jeremy

Eric Shulman

unread,
Jun 22, 2021, 3:04:02 PM6/22/21
to TiddlyWiki
On Tuesday, June 22, 2021 at 11:25:23 AM UTC-7 cj.v...@gmail.com wrote:
Is there some other way of getting the result of a filter that's less weird than using TiddlyWiki's triple curly brackets ?
I just threw that together quickly as an example re getting color "filterily(?)"
It would be great to see some alternative approaches, I think.

Instead of using filtered transclusion (the tripled curly braces) to concatenate values stored in variables, you can use a macro definition, like this:

\define colorCSS() border:25px solid rgb($(rgbArg1)$,$(rgbArg1)$,$(rgbArg3)$);
<$vars thisSecond=<<now ss>> >
<$vars rgbArg1={{{ [<thisSecond>multiply[3]] }}} rgbArg3={{{ [<thisSecond>multiply[5]] }}}>
<div style=<<colorCSS>>>Some Text</div>
</$vars>
</$vars>

I think this is a much easier syntax to understand and use

-e

Mohammad Rahmani

unread,
Jun 22, 2021, 3:46:12 PM6/22/21
to tiddl...@googlegroups.com
Jeremy!
 
Many thanks for clarification!



Best wishes
Mohammad


Mohammad Rahmani

unread,
Jun 22, 2021, 3:54:01 PM6/22/21
to tiddl...@googlegroups.com
Hi Eric,
 Yes, simpler is always better as long as it works correctly! I like your solution!
 If I am correct, this code should not update the color field automatically!
 I mean for a tiddler called  test, can I use something like this?

\define colorCSS()  rgb($(rgbArg1)$,$(rgbArg1)$,$(rgbArg3)$);  
color field:   <<colorCSS>>

Here the color field shall be updated dynamically!

If so then what Atro has requested can be obtained

<$vars thisSecond={{{ [tag[foo]count[]] }}}  >  




--
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 tiddlywiki+...@googlegroups.com.

Charlie Veniot

unread,
Jun 22, 2021, 8:03:59 PM6/22/21
to TiddlyWiki
Hey Atro, to steer this back to your original issue:  "it seems that /TiddlyWiki/ does not allow to change color dynamically."

Does all of the above address all that you were thinking?

Aside: that was a fun coding exercise.  Thanks !

On Tuesday, June 22, 2021 at 8:58:30 AM UTC-3 Atronoush wrote:

Charlie Veniot

unread,
Jun 22, 2021, 8:09:03 PM6/22/21
to TiddlyWiki
Oh yeah, side-note:

Thinking about what you're doing, I Imagine all sorts of fun applications related to dynamic colours, for example: tasks that have a certain colour when the due date is far away, and the colour changes to something else (whatever you consider a "critical colour") as the due date approaches.

Well, most likely has done before in some plugin somewhere, I just haven't explored enough of them yet.

On Tuesday, June 22, 2021 at 8:58:30 AM UTC-3 Atronoush wrote:
Reply all
Reply to author
Forward
0 new messages