Menu

Prettify default map help/questions tips

Bugs Bunny
2021-05-26
2021-06-01
  • Bugs Bunny

    Bugs Bunny - 2021-05-26

    Hey guys, maybe some of you power users can help me out. Coming from and seeing other plethora of mindmaps whose default looks are 10x ahead and lack 100x the functionality I'm quite enjoying using Freeplane but could really use pointers on how to make it visually easier to distinguish between Level 1, 2 , 3 etc. nodes by default everything looks the same. Is there a way to make it so the first node is styled lets say a thicker color and subsequent node is styled in a lighter color by default ? things of this nature .

     
  • lilive

    lilive - 2021-05-26

    Hi,
    Are you looking for hierarchical level styles ?
    Read the menu Help > Documentation (or F1 key):
    6 Formatting & styling > 6.2 Styles > Hierarchical level styles

     
  • Bugs Bunny

    Bugs Bunny - 2021-05-26

    Level styles I understand ; but the documentation loses me at the Conditional Styled aspect. Because when I edit the level styles for instances Level 1 is dark green background ; Level 2 is lighter shade of green... well then every single level 1 and level 2 follows green where i don't want it to be green per say . I want it to be a shade of the automatic edge coloring thats given . Say 1 node is red and another is blue ; i want it to follow that color scheme.

     
  • Bugs Bunny

    Bugs Bunny - 2021-05-26

    Edit: Delete Post ; its a repeat of above.

     

    Last edit: Bugs Bunny 2021-05-27
  • kewapo

    kewapo - 2021-05-27

    You can customize all styles in the current map (and add your own styles).

    Go to the styles editor in this way: click on Format menu, Manage styles, Edit styles. You can see a mindmap with the current map styles. Change all you want and then click on the green tick icon of the top bar, under the File menu.

    You've changed the map styles.

     
    • Bugs Bunny

      Bugs Bunny - 2021-05-27

      Maybe I'm not coming across properly.

      simply restating .

      1. An individual can change edge colors through the 'Format' window
      2. I want a Level 1 to be dynamic like edge colors
      3. Suppose the first edge color that was auto generated is green
      4. I want the first Level to have a FILL (Body fill) to match that specific edge color (green in this case)
      5. I want Level 2 (the next child node) to be a LIGHTER SHADE than the first one

      How do I achieve this...
      because based on the responses what the suggestions do is change EVERY LEVEL 1 AND EVERY LEVEL 2 ETC. ; they fill color is NOT DYNAMIC .

      Please let me know if I'm still not coming across properly, and I will make a video.

       
  • Edo Frohlich

    Edo Frohlich - 2021-05-29

    Hi,
    I made a script for this (just for fun)

    I took some methods from the Geoscript Groovy project

    And got the following code. It does sort of what you asked for, but I think it needs some improvements, but it can be used as a starting point:

    import java.awt.Color
    
    def nodos = root.findAll() - root
    
    nodos.each{ n ->
        def color = n.style.edge.color // class java.awt.Color
        def niv = n.getNodeLevel(true)
        def factor = 1 - 1/niv
        n.style.backgroundColor = brighter(color, factor)
    }
    
    return nodos.size()
    
    def brighter(col, f){
        def hsl = getHsl(col)
        def L   = hsl[2] + (1 - hsl[2]) * f
        hsl[2]  = L<1?L:1
        def rgb = hsl2rgb(hsl)
        new Color(rgb.r,rgb.g,rgb.b)
    }
    
    // ---------------Methods taken from https://github.com/geoscript/geoscript-groovy/   (MIT license) --------------------------
    
    
        /**
         * Get this Color's HSL value
         * @return A List of HSL values all between 0 and 1
         */
        List getHsl(color) {
            double r = color.red / 255.0
            double g = color.green / 255.0
            double b = color.blue / 255.0
            double lo = Math.min(Math.min(r,g),b)
            double hi = Math.max(Math.max(r,g),b)
            def (double h, double s, double l) = [(lo + hi) / 2.0] * 3
            if (lo == hi) {
                (h, s) = [0,0]
            } else {
                float d = (hi - lo) as float
                s = l > 0.5 ? d / (2 - hi - lo) : d / (hi + lo)
                switch (hi) {
                    case r:
                        h = (g - b) / d + (g < b ? 6 : 0)
                        break
                    case g:
                        h = (b - r) / d + 2
                        break
                    case b:
                        h = (r - g) / d + 4
                        break
                }
                h /= 6
            }
            return [h,s,l]
        }
    
        /**
         * Convert a HSL Color (as a List) into a Map of RGB values
         * @param hsl The HSL List
         * @return A Map of RGB values
         */
        Map hsl2rgb(List hsl) {
            double r,g,b
            def (double h, double s, double l) = hsl
            if (s == 0) {
                (r,g,b) = [l,l,l]
            } else {
                double q = l < 0.5 ? l * (1 + s) : l + s - l * s
                double p = 2 * l - q
                r = hue2rgb(p, q, h + 1/3)
                g = hue2rgb(p, q, h)
                b = hue2rgb(p, q, h - 1/3)
            }
            [
                r: Math.round(r * 255) as int,
                g: Math.round(g * 255) as int,
                b: Math.round(b * 255) as int
            ]
        }
    
        double hue2rgb(double p, double q, double t) {
            if (t < 0) t += 1
            if (t > 1) t -= 1
            if (t < 1/6) return p + (q - p) * 6.0 * t
            if (t < 1/2) return q
            if (t < 2/3) return p + (q - p) * (2/3.0 - t) * 6.0
            return p
        }
    

    Attached is an image of the resulting map

     
    • euu

      euu - 2021-05-30

      The result looks good!

       
    • Bugs Bunny

      Bugs Bunny - 2021-05-31

      you my man are a god ; this is exactly what I was looking for and since I have 0 knowledge for scripting. the fact that you were able to share this and I can work with minor changes ; in my cases only color ; but this is perfect man. so much easier for me to visualize (everyone is different) thanks mate .

       
      👍
      1
    • Bugs Bunny

      Bugs Bunny - 2021-05-31

      Repeat; once again . I dont know why

       

      Last edit: Bugs Bunny 2021-05-31
  • sfpcom

    sfpcom - 2021-05-31

    Hi Edo, may you explain how to activate it? Is it a full script?
    Thanks
    SFPC

     
  • sfpcom

    sfpcom - 2021-05-31

    Hi Edo, may you explain how to activate it? Is it a full script?
    Thanks
    SFPC

     
  • sfpcom

    sfpcom - 2021-05-31

    Hi Edo, may you explain how to activate it? Is it a full script?
    Thanks
    SFPC

     
  • Edo Frohlich

    Edo Frohlich - 2021-06-01

    Hi,
    It worked when using the Groovy Console (Wikdshell extension), but not as script, because rootneeds to be changed to node.map.rootin the script.

    It takes the edge colors as base color to paint the background of the nodes.

    I changed the first part of the code to this:

    import java.awt.Color
    
    def minLight = 0.4f
    def maxLight = 1f
    def flatness = 2f
    def fC = (flatness + minLight - maxLight)/(maxLight-minLight)
    
    
    node.map.root.children.each{ ch ->  
        def color = ch.style.edge.color
        def nodos = ch.findAll()
        nodos.each{ n ->
            def niv = n.getNodeLevel(true)
            def lightFactor = maxLight - flatness/(niv + fC)
            n.style.backgroundColor = brighter(color, lightFactor)
        }
    }
    
    def brighter(col, L){
        def hsl = getHsl(col)
        hsl[2]  = L<1?L>0?L:0:1
        def rgb = hsl2rgb(hsl)
        new Color(rgb.r,rgb.g,rgb.b)
    }
    

    and it works better.

    I attached a sample map. The script is in one node. You have to execute it and it will paint the map.

    I used automatic edge colors when creating the map (Option in toolpanel)

    BR
    edo

     
  • Edo Frohlich

    Edo Frohlich - 2021-06-01

    and here a last version with two scripts. (the second one does the same but is more efficient)
    BR
    edo