Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualizer hard to see with dark mode on #48

Closed
ashblue opened this issue Mar 24, 2021 · 10 comments
Closed

Visualizer hard to see with dark mode on #48

ashblue opened this issue Mar 24, 2021 · 10 comments
Labels
help wanted Extra attention is needed released

Comments

@ashblue
Copy link
Owner

ashblue commented Mar 24, 2021

Currently hard to read the visualizer with Dark Mode. Would be good if more neutral colors were used on the connecting lines.

@ashblue ashblue added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 24, 2021
@ashblue
Copy link
Owner Author

ashblue commented Mar 24, 2021

Great first issue if somebody wants to tackle it.

@Ownezx Ownezx mentioned this issue Feb 18, 2022
@wihu
Copy link

wihu commented Dec 27, 2022

any update on this? the PR seems stalled..

@ashblue
Copy link
Owner Author

ashblue commented Jan 9, 2023

Haven't touched any AI for a while so I've been working on other libraries. Somebody pushed up a PR to get this going but it still needs some work.

@ashblue ashblue removed the good first issue Good for newcomers label Jan 9, 2023
@ashblue
Copy link
Owner Author

ashblue commented Jan 9, 2023

Issue is mostly done here. Needs some cleanup to be finished #69

@JeremyVansnick
Copy link

JeremyVansnick commented Apr 11, 2024

In order to make dark mode easily visible I changed the colors of the NodeFaders based on whether the dark mode is on or not.

using UnityEditor;
using UnityEngine;

namespace CleverCrow.Fluid.BTs.Trees.Editors {

    public class NodeFaders {
        public ColorFader BackgroundFader { get; } = new ColorFader(
            EditorGUIUtility.isProSkin ?
            new Color(0, 0f, 0.8f) : new Color(0.65f, 0.65f, 0.65f), 
            EditorGUIUtility.isProSkin ? 
                new Color(0f, 1f, 0f) : new Color(0.39f, 0.78f, 0.39f));
        
        public ColorFader TextFader { get; } = new ColorFader(
            EditorGUIUtility.isProSkin ?
                Color.black : Color.white,
            EditorGUIUtility.isProSkin ?
                Color.white : Color.black);
        
        public ColorFader MainIconFader { get; } = new ColorFader(
            new Color(1, 1, 1, 0.3f), new Color(1, 1, 1, 1f));
        
        public ColorFader LastStatusFader { get; } = new ColorFader(
                Color.grey, Color.white);

        public void Update (bool active) {
            BackgroundFader.Update(active);
            TextFader.Update(active);
            MainIconFader.Update(active);
            LastStatusFader.Update(active);
        }
    }
}

I made the StatusIcons saturated and managed their darkness through code (they were really dark which didn't fit for dark mode):
image

Finally, because the last task status overlaps with the names of tasks if the text is long, I put the task status at the top right of the nodes.

public class NodePrintController {     
private void PrintLastStatus (Rect rect) {
            const float sidePadding = 1.5f;

            var icon = BehaviorTreePrinter.StatusIcons.GetIcon(_node.Task.LastStatus);
            icon.Paint(
                new Rect(
                    rect.x + rect.size.x - icon.Texture.width - sidePadding,
                    // rect.y + rect.size.y - icon.Texture.height - sidePadding, // original code
                    rect.y, // new code
                    icon.Texture.width, icon.Texture.height),
                _faders.LastStatusFader.CurrentColor);
        }
}
       

@ashblue
Copy link
Owner Author

ashblue commented Apr 14, 2024

Connected PR hits most of this. I'll cross reference the code you posted when I run through it.

@darkgnostic
Copy link

darkgnostic commented Jul 23, 2024

Actually the most problem comes from NodeBoxStyle.cs and default style of GUI.skin.box

    Style = new GUIStyle(GUI.skin.box) {
        border = new RectOffset(1, 1, 1, 1),
        normal = {
            background = texture,
        },
    
    };

changing that to

        Style = new GUIStyle {
            border = new RectOffset(1, 1, 1, 1),
            normal = {
                background = texture,
            },
            
            alignment = TextAnchor.MiddleCenter,
            padding = new RectOffset(4, 4, 4, 4),
            margin = new RectOffset(4, 4, 4, 4),
            overflow = new RectOffset(0, 0, 0, 0),
            stretchWidth = false,
            stretchHeight = false,
        };

solves the box background issues.

@ashblue
Copy link
Owner Author

ashblue commented Jul 29, 2024

@darkgnostic Fascinating. This would explain some things across several different packages I'm seeing if this fixes the issue.

@ashblue
Copy link
Owner Author

ashblue commented Nov 9, 2024

@darkgnostic yep this fixes the issue. Sorry for the delay. I'll get a patch out before the week is over

ashblue pushed a commit that referenced this issue Nov 9, 2024
@ashblue ashblue closed this as completed in b3dd08f Nov 9, 2024
ashblue pushed a commit that referenced this issue Nov 9, 2024
# [2.3.0](v2.2.3...v2.3.0) (2024-11-09)

### Bug Fixes

* **assetpath.cs:** retarget PATH_PROJECT ([45f5620](45f5620)), closes [#79](#79)
* **builds:** node version now pulls from .nvmrc ([8564210](8564210))
* **conditions:** generic condition had exit and init reversed ([c9ac8cc](c9ac8cc))
* **dark mode:** boxes keep proper color in dark mode for the visualizer ([b3dd08f](b3dd08f)), closes [#48](#48)
* **visualizer:** vertically connected nodes now connect properly ([321e47e](321e47e)), closes [#29](#29)

### Features

* **visualizer:** pausing the game now keeps active node highlighting ([b031653](b031653)), closes [#94](#94)
@ashblue
Copy link
Owner Author

ashblue commented Nov 9, 2024

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed released
Projects
None yet
Development

No branches or pull requests

4 participants