Skip to content

feat(#304) Environments color 🎨#1053

Merged
sid-bruno merged 14 commits intousebruno:feature/environment-color-extendedfrom
MathieuDreano:feature/environment-color
Jan 29, 2026
Merged

feat(#304) Environments color 🎨#1053
sid-bruno merged 14 commits intousebruno:feature/environment-color-extendedfrom
MathieuDreano:feature/environment-color

Conversation

@MathieuDreano
Copy link
Contributor

@MathieuDreano MathieuDreano commented Nov 25, 2023

Description

associated issue: close #304

Associate a color to each environment, for quick visualization (and avoid calling your production environment by mistake...)

environment selection:
image

environment settings
image

env.bru format
image

highlight on request tab
image

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes --> well, I hope so
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Summary by CodeRabbit

  • New Features

    • In-app environment color picker and persistent environment colors
    • Color indicators displayed next to environments and in the active environment UI
  • Refactor

    • Improved environment selection state handling for more reliable behavior
    • Environment import/export and file format extended to include color
  • Style

    • Updated selector and active tab visuals to reflect environment colors

✏️ Tip: You can customize this high-level summary in your review settings.

@MathieuDreano MathieuDreano marked this pull request as draft November 25, 2023 17:30
@MathieuDreano MathieuDreano changed the title [WIP] associate colors to environments feat(#304) Environments color Nov 25, 2023
@MathieuDreano MathieuDreano force-pushed the feature/environment-color branch from c831150 to 10e7f14 Compare November 26, 2023 14:04
@MathieuDreano MathieuDreano marked this pull request as ready for review November 26, 2023 19:45
@MathieuDreano MathieuDreano force-pushed the feature/environment-color branch from eb02a3c to 0bf21d1 Compare November 26, 2023 23:08
@edbrannin
Copy link
Contributor

It would be nice if this could tint more than just the Environment button in the corner, but that's probably best left as a follow-up.

(Also, why all the force-pushes?)

@MathieuDreano MathieuDreano marked this pull request as draft November 28, 2023 09:37
@aphexcx
Copy link

aphexcx commented Feb 9, 2024

Hi! When will this be merged? This one feature is the only thing stopping us from moving from Insomnia to Bruno LOL

@MathieuDreano MathieuDreano force-pushed the feature/environment-color branch from 0f443d6 to 339687a Compare February 14, 2024 20:56
@MathieuDreano MathieuDreano marked this pull request as ready for review February 15, 2024 09:02
@MathieuDreano
Copy link
Contributor Author

quite some changes, using redux store.
I think it's ready, feel free to try it out. I personally use it in my daily job.

@MathieuDreano
Copy link
Contributor Author

As requested, added visual aid on request tab
image

@MathieuDreano MathieuDreano changed the title feat(#304) Environments color feat(#304) Environments color 🔴🔵🟡 Feb 15, 2024
@MathieuDreano MathieuDreano changed the title feat(#304) Environments color 🔴🔵🟡 feat(#304) Environments color 🎨 Feb 15, 2024
@aphexcx
Copy link

aphexcx commented Mar 12, 2024

Following up on this, really appreciate seeing the progress:)

@aphexcx
Copy link

aphexcx commented Mar 21, 2024

Checking in again:)

@aphexcx
Copy link

aphexcx commented Apr 11, 2024

Friendly ping:)

@bobzomer
Copy link

bobzomer commented May 8, 2024

Friendly ping:)

I would also love it to see it merged and available in my beloved bruno!

@aphexcx
Copy link

aphexcx commented May 30, 2024

Beep 🤖

@florianlacreuse
Copy link

Any updates on this PR? It would be nice to have it in Bruno. Thanks!

@aeris
Copy link

aeris commented Jul 24, 2024

If something interested, I rebase this PR on v1.23.0
https://git.imirhil.fr/aeris/bruno/src/branch/feature/environment-color

@MathieuDreano MathieuDreano force-pushed the feature/environment-color branch from 2709a60 to 77c6714 Compare July 24, 2024 23:06
@MathieuDreano
Copy link
Contributor Author

MathieuDreano commented Jul 24, 2024

Hello there, I rebased the work onto main branch. (not something I will do every month, fixing conflicts..)

@peterkeppert-anasoft
Copy link

Hello, could somebody from Bruno maintainers please indicate what is the expected timeframe of this feature's integration or what are the next steps with this pull request?

Certainly for our team (and I believe many others) used to Insomnia's environment colors, this represents a significant and eagerly awaited UX improvement. Thanks!

@SZubarev
Copy link

Any updates on this feature?

mdreano and others added 3 commits January 28, 2026 07:15
…ings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js (1)

27-45: Potential infinite loop and redundant logic in the effect.

This effect has selectedEnvironment in its dependency array while also calling setSelectedEnvironment inside. This can cause repeated re-runs. Additionally, lines 29-33 already find and set _selectedEnvironment, but line 35 immediately overwrites it with another lookup—this appears redundant.

Consider consolidating the logic:

🐛 Proposed fix
  useEffect(() => {
    if (selectedEnvironment) {
-     const _selectedEnvironment = environments?.find(env => env?.uid === selectedEnvironment?.uid);
-     const hasSelectedEnvironmentChanged = !isEqual(selectedEnvironment, _selectedEnvironment);
-     if (hasSelectedEnvironmentChanged) {
-       setSelectedEnvironment(_selectedEnvironment);
-     }
-     setOriginalEnvironmentVariables(selectedEnvironment.variables);
-     setSelectedEnvironment(findItem(environments, selectedEnvironment.uid));
+     const updatedEnv = findItem(environments, selectedEnvironment.uid);
+     if (updatedEnv && !isEqual(selectedEnvironment, updatedEnv)) {
+       setSelectedEnvironment(updatedEnv);
+       setOriginalEnvironmentVariables(updatedEnv.variables);
+     }
      return;
    }

    const environment = findItem(environments, activeEnvironmentUid);
    if (environment) {
      setSelectedEnvironment(environment);
    } else {
      setSelectedEnvironment(environments?.length ? environments[0] : null);
    }
- }, [activeEnvironmentUid, selectedEnvironment]);
+ }, [activeEnvironmentUid, environments]);
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js (2)

47-51: Redundant effect—already handled above.

This effect syncs selectedEnvironment when environments changes, but the first effect (lines 27-45) should already handle this if its dependencies are corrected. Consider removing this effect to avoid duplicate re-renders and potential race conditions between effects.

♻️ Proposed removal
- useEffect(() => {
-   if (selectedEnvironment) {
-     setSelectedEnvironment(findEnvironmentInCollection(collection, selectedEnvironment.uid));
-   }
- }, [environments]);

2-2: Inconsistent usage of findItem vs findEnvironmentInCollection.

Line 35 uses findItem(environments, ...) while line 49 uses findEnvironmentInCollection(collection, ...). Both accomplish the same goal but with different signatures. Pick one approach for consistency—findItem operates on the array directly, while findEnvironmentInCollection expects the collection object.

Also applies to: 35-35, 49-49

Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
@sid-bruno sid-bruno added the adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers label Jan 29, 2026
@sid-bruno
Copy link
Collaborator

sid-bruno commented Jan 29, 2026

Hey, @MathieuDreano thanks for the contribution, there's internal work going on to improve and polish your PR, would you mind if the contributors adopted this PR and merged it in?

@sid-bruno sid-bruno removed the adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers label Jan 29, 2026
@mdreano
Copy link
Contributor

mdreano commented Jan 29, 2026

Hello @sid-bruno good to know you're working on it, I leave it to you ! You can merge as much as you want !

@sid-bruno
Copy link
Collaborator

Cool, i'll merge this in and then we'll take it from there

mostly because of design consistency

@sid-bruno sid-bruno added the adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers label Jan 29, 2026
@sid-bruno sid-bruno changed the base branch from main to feature/environment-color-extended January 29, 2026 10:33
@mdreano
Copy link
Contributor

mdreano commented Jan 29, 2026

@sid-bruno one thing that would be nice and I didn't have the time to look up, use oklch to better handle light/dark theme.

Cool, i'll merge this in and then we'll take it from there

mostly because of design consistency

@sid-bruno
Copy link
Collaborator

@sid-bruno one thing that would be nice and I didn't have the time to look up, use oklch to better handle light/dark theme.

Cool, i'll merge this in and then we'll take it from there
mostly because of design consistency

Probably over time, currently the theme structure has just gotten hardened and is on RGB, will take this up as we get more time to polish the color accuracy

@sid-bruno sid-bruno merged commit fc4dcc9 into usebruno:feature/environment-color-extended Jan 29, 2026
2 checks passed
sid-bruno pushed a commit that referenced this pull request Jan 30, 2026
* associate environment to a color

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

use StyledWrapper

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

don't save anything for color if it is not set

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

use redux store instead of local state

remove logs

fix selectedEnvironment

cleanup

add bottom border on active tab

* associate environment to a color

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* move dependency to appropriate package.json

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* use border instead of background color

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* simplify onColorChange

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* add black, keep backgound on unselected color

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* fix conflicts

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

* associate environment to a color

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

use StyledWrapper

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

don't save anything for color if it is not set

Signed-off-by: mathieu <mathieu.dreano@gmail.com>

use redux store instead of local state

remove logs

fix selectedEnvironment

cleanup

add bottom border on active tab

# Conflicts:
#	packages/bruno-app/src/components/Environments/EnvironmentSelector/StyledWrapper.js
#	packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js
#	packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/index.js
#	packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js
#	packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
#	packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js

* Update packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* unused selectedEnvironment prop in EnvironmentList

Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>

* RequestTab, avoid unnecessary call if undefined activeCollection

Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>

* use @uiw/reac-color instead of react-color

Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>

---------

Signed-off-by: mathieu <mathieu.dreano@gmail.com>
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
Co-authored-by: Mathieu D <mathieu.dreano@decathlon.com>
Co-authored-by: Anoop M D <anoop@usebruno.com>
Co-authored-by: Mathieu DREANO <122891400+mdreano@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
sid-bruno added a commit that referenced this pull request Jan 30, 2026
@sid-bruno
Copy link
Collaborator

Merged into main #6970

Thanks @mdreano

@MathieuDreano
Copy link
Contributor Author

You're welcome, I looked at your "polish", you did like 90% of the job 😅
Congratulations to you.

@coderabbitai coderabbitai bot mentioned this pull request Feb 2, 2026
6 tasks
@sid-bruno
Copy link
Collaborator

You're welcome, I looked at your "polish", you did like 90% of the job 😅 Congratulations to you.

Even if it was one line from you, it's still a contribution and I wouldn't want to take that away from you. This should be available in the next release

@coderabbitai coderabbitai bot mentioned this pull request Feb 13, 2026
6 tasks
bijin-bruno pushed a commit that referenced this pull request Feb 13, 2026
…and refactor License component to remove unnecessary props (#1053)
@coderabbitai coderabbitai bot mentioned this pull request Mar 3, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers long-term-goal pr-feature size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature request: colored environments