-
Notifications
You must be signed in to change notification settings - Fork 882
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
Feat: vela top
supports custom theme features
#5180
Conversation
Codecov ReportBase: 61.18% // Head: 61.13% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5180 +/- ##
==========================================
- Coverage 61.18% 61.13% -0.06%
==========================================
Files 305 305
Lines 45437 45437
==========================================
- Hits 27799 27776 -23
- Misses 14783 14805 +22
- Partials 2855 2856 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
6677e60
to
3063e7e
Compare
Great job, how can I swith these different themes? Do we embed these themes as builtin ones? |
You can use the environment variable to set the theme config file. These theme files can be obtained from the kubevela repository. Or you can define your theme config file and use it by setting the env |
@Hanmengnan We can use go |
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
3063e7e
to
cbfdcac
Compare
Signed-off-by: HanMengnan <1448189829@qq.com>
Signed-off-by: HanMengnan <1448189829@qq.com>
428564c
to
6c4a124
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job, please also add usage docs to https://kubevela.net/docs/tutorials/vela-top
Ok, I will update the usage docs soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job! Some questions:
- Do users need to make migration from k9s theme files or they just need to copy them?
- Is the theme file location the same as k9s or is there any other location or flags to load these theme files?
|
* Feat: add the diy theme feature Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add test case Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: update go mod to fix vela top can't show on some terminal Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add test case Signed-off-by: HanMengnan <1448189829@qq.com> * Feat: embed theme file Signed-off-by: HanMengnan <1448189829@qq.com> * Feat: add theme selector and add test cases Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: fix type bug Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: fix some file bugs Signed-off-by: HanMengnan <1448189829@qq.com> Signed-off-by: HanMengnan <1448189829@qq.com>
* Feat: add the diy theme feature Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add test case Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: update go mod to fix vela top can't show on some terminal Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add test case Signed-off-by: HanMengnan <1448189829@qq.com> * Feat: embed theme file Signed-off-by: HanMengnan <1448189829@qq.com> * Feat: add theme selector and add test cases Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: fix type bug Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: fix some file bugs Signed-off-by: HanMengnan <1448189829@qq.com> Signed-off-by: HanMengnan <1448189829@qq.com>
Description of your changes
Background
The current theme color matching of vela top cannot be changed. It uses color names like blue and red to describe the colors in the UI.
However, this leads to a problem that the colors will vary according to the terminal colors, so the colors will appear strange on some users' terminals.
Solution
Therefore, I want to introduce a solution, that is, add the feature of custom theme in vela top. The theme file is described by YAML file. And I migrate some theme files of k9s to this format file and I have embed some theme in vela top.
Users can use
ctrl + t
to enter the theme switch view. The view will display embed themes and custom themes.After selecting theme, users need to restart vela top to make new theme take effect.
The format of the theme configuration file is as follows, and users can define their custom theme config files in folowing format and put them in
~/.vela/theme/themes/
dir to add the custom theme to vela top.I have migrated several themes. The preview of the theme is as follows:
dracula
![image](https://user-images.githubusercontent.com/30918851/201625951-14124a43-bfa1-4bc7-bd4e-c1a0105a724a.png)
nord
![image](https://user-images.githubusercontent.com/30918851/201625793-8fb40d75-5322-4eb5-b09e-f1cb4d24fc98.png)
one_dark
![image](https://user-images.githubusercontent.com/30918851/201625555-55cbb002-8a1c-40ee-a8ae-29e595f11163.png)
red
![image](https://user-images.githubusercontent.com/30918851/201625459-31a06d4a-762b-44c7-b8b9-34cefe878f63.png)
Fixes #5063
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Special notes for your reviewer