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

Entity Path syntax highlighting #4598

Closed
emilk opened this issue Dec 20, 2023 · 2 comments · Fixed by #4803
Closed

Entity Path syntax highlighting #4598

emilk opened this issue Dec 20, 2023 · 2 comments · Fixed by #4803
Assignees
Labels
enhancement New feature or request ui concerns graphical user interface

Comments

@emilk
Copy link
Member

emilk commented Dec 20, 2023

Whenever we show an entity path in the UI we should use syntax highlighting:

  • the path separator / should use a different color, and probably have an extra half-space on each side
  • any escape sequence should have a different color to indicate that the \ is not a literal backslash
@emilk emilk added enhancement New feature or request ui concerns graphical user interface labels Dec 20, 2023
@emilk
Copy link
Member Author

emilk commented Dec 21, 2023

I started working a bit on this in the emilk/syntax-highlighting branch, but there is a snag: sometimes an entity path is shown as an noninteractiver label, and sometimes as an interactive button, and that means different text colors. I'm not sure how to nicely handle that. How does the syntax highlighter know if it is highlighting for a label or a button?

One option it to use a special None color for the bulk of the path, and then have egui replace that with the "current" text color when painted (requires an egui change). Slashes and escapes would always have the same color, regardless of where they are.

If we ever implement emilk/egui#3284 then we could use a "tint" modifier or something instead of hard-coded colors, but we're not there.

@emilk
Copy link
Member Author

emilk commented Dec 22, 2023

@emilk emilk self-assigned this Jan 15, 2024
emilk added a commit that referenced this issue Jan 15, 2024
### What
* Closes #4598

Adds basic syntax highlighting to patsh. Slashes and brackets are in a
fixed bright-white color, while the text uses the color appropriate for
the widget it is in (labels are dimmer than button, for instance).

For labels this produces a lot of contrast:

![image](https://github.com/rerun-io/rerun/assets/1148717/b77139e6-6a5e-4779-a367-c64026997b47)

For buttons, not so much:

![image](https://github.com/rerun-io/rerun/assets/1148717/104f59b1-8226-4b88-a1e6-3c0a7d93ae14)


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4803/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4803/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4803/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4803)
- [Docs
preview](https://rerun.io/preview/6243e3c459dffd9c6c7f9f72c2bc4d9ab176044c/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/6243e3c459dffd9c6c7f9f72c2bc4d9ab176044c/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ui concerns graphical user interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant