# REPL color questions: variable names, seeing them, and setting RGB values

**URL:** <https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743>\
**Category:** New to Julia\
**Created:** [October 14, 2022, 3:54pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743 "2022-10-14T15:54:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 14, 2022, 3:54pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/1 "2022-10-14T15:54:39Z")

</div>

The REPL’s package mode prompt is too dark, and I want to change it.

I’ve found the [REPL documentation](https://docs.julialang.org/en/v1/stdlib/REPL/), and it shows how to set variables using startup.jl, and I now have a few questions that go beyond changing the prompt color.

What is the variable name for the package prompt?

The name probably starts with ‘repl.’, so how do I get a list of all variables starting with ‘repl.’?

The documentation says “the available color keys can be seen by typing Base.text in help mode”, but it doesn’t show the colors, it just shows a short list of color names. Besides, assigning these names to variables using startup.jl, how can I see the colors associated with the names using the REPL?

I will almost certainly want to adjust the individual RGB values for the package mode prompt. How does one do that?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 14, 2022, 4:21pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/2 "2022-10-14T16:21:03Z")

</div>

Have a look at

> **[GitHub - KristofferC/OhMyREPL.jl: Syntax highlighting and other enhancements...](https://github.com/KristofferC/OhMyREPL.jl)**
>
> Syntax highlighting and other enhancements for the Julia REPL - GitHub - KristofferC/OhMyREPL.jl: Syntax highlighting and other enhancements for the Julia REPL

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 14, 2022, 4:32pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/3 "2022-10-14T16:32:54Z")

</div>

Thanks oheil. I saw that last night, and I rescanned its documentation just now. While I can imagine I might be able to use this, and I don’t get the feeling it deals with the package mode prompt, I don’t want to get bogged down making a new theme right now. I’m more interested in things like discovering variable names and setting RGB values for something specific.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 14, 2022, 5:10pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/4 "2022-10-14T17:10:02Z")

</div>

For example:

```julia
help?> Base.text_colors
  Dictionary of color codes for the terminal.

  Available colors are: :normal, :default, :bold, :black, :blink, :blue, :cyan, :green, :hidden, :light_black,
  :light_blue, :light_cyan, :light_green, :light_magenta, :light_red, :light_white, :light_yellow, :magenta, :nothing,
  :red, :reverse, :underline, :white, or :yellow as well as the integers 0 to 255 inclusive.

  The color :default will print text in the default color while the color :normal will print text with all text
  properties (like boldness) reset. Printing with the color :nothing will print the string without modifications.

julia> println(Base.text_colors[:light_red] * "light_red")
light_red

```

Of course you can’t see the color here, but in your REPL it should appear “light\_red” in a light\_red color 🙂

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 14, 2022, 5:17pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/5 "2022-10-14T17:17:42Z")

</div>

> [@matw](#):
>
> What is the variable name for the package prompt?

The package prompt is probably defined in `Pkg`. Now you say

> [@matw](#):
>
> I’m more interested in things like discovering variable names

so do you want me to tell you how to change the pkg prompt or do you want me to help you finding out on your own?  
(Currently I don’t know if it’s easy to change it and how it works, I have just an idea).

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 14, 2022, 6:59pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/6 "2022-10-14T18:59:55Z")

</div>

Thank you again oheil. I’m looking forward to repeating your example when I finish my work day. That’s exactly the kind of thing I want to try in the REPL.

> [@oheil](#):
>
> so do you want me to tell you how to change the pkg prompt or do you want me to help you finding out on your own?  
> (Currently I don’t know if it’s easy to change it and how it works, I have just an idea)

Well, I want to learn both. So go ahead and share your thoughts. Telling me the answer won’t keep me from working on how to go about finding it. Your answer will only help.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 14, 2022, 7:32pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/7 "2022-10-14T19:32:14Z")

</div>

You can’t change the Pkg prompt ‘pkg\>’ it’s hard coded in  
…\share\julia\stdlib\v1.8\Pkg\src\REPLMode\REPLMode.jl:

```julia
function promptf()
    ...
    return "$(prefix)pkg> "
end

```

But changing it in the file can be done of course.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [October 14, 2022, 7:37pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/8 "2022-10-14T19:37:03Z")

</div>

> [@matw](#):
>
> The REPL’s package mode prompt is too dark, and I want to change it.

I once proposed changing the default palette, but the issue was closed. There isn’t strictly any default palette, or at least it differs by terminal. In my Linux Mint the background was grey and I don’t understand it at all, why would any programmer want that?! I changed to a non-default palette (which might be default for others) and everything is fine now.

Are you on Windows and what terminal do you use?

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 14, 2022, 9:44pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/9 "2022-10-14T21:44:38Z")

</div>

> [@Palli](#):
>
> Are you on Windows and what terminal do you use?

Windows and PowerShell (for now). I can’t cut and paste into my Julia session (grr) ; PowerShell and I may have a short relationship. Fortunately oheil’s printf example was short enough to type.

> [@Palli](#):
>
> …, why would any programmer want that?

There’s no accounting for taste. Seriously, it’s almost impossible to know, or anticipate, all expectations or situations.

I don’t fault anyone for making a choice for the Pkg prompt that I wouldn’t make, but I expect to be able to change it to improve visibility on my system.

oheil points out I can mod the code on my system, which I’ll mess with once I find it. 🙂

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [October 15, 2022, 9:00am UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/10 "2022-10-15T09:00:46Z")

</div>

> [@matw](#):
>
> The REPL’s package mode prompt is too dark, and I want to change it.

This was the subject of an issue in 2019 - [BLue colour on black bacground - almost invisible · Issue #788 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/issues/788) - As yet, no-one has volunteered to make a PR. Perhaps Pkg mode could be added to the modes described in [Customizing-Colors](https://docs.julialang.org/en/v1/stdlib/REPL/#Customizing-Colors).

To be honest, it would be easier to redefine the terminal’s idea of “blue”:

 ![Screenshot 2022-10-15 at 09.58.54](https://global.discourse-cdn.com/julialang/original/3X/7/9/79be75b6f53bd8ec17fc117a58015d6f92088f5a.jpeg)

although I’m not familiar with the abilities of your terminal program in this area.

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 15, 2022, 6:26pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/11 "2022-10-15T18:26:25Z")

</div>

> [@cormullion](#):
>
> To be honest, it would be easier to redefine the terminal’s idea of “blue”

Yes, changing the terminal’s idea of “blue” is easier, but Microsoft chose to be incompatible. They still don’t provide this ability in PowerShell. PowerShell’s “experimental terminal settings” link mentions VT codes, which seem to be what Base.text\_colors contains: “[e[38;5;86m” for example.

If I understand correctly, because colors are chosen by VT codes, I won’t be able to remap the VT code to RGB values unless I can do it in the terminal settings. That leaves modifying my local REPLMode.jl, or using a different terminal. Neither choice sounds attractive.

Please let me know if I’ve read the situation wrong.

For the record, VS Code’s Julia extension doesn’t have this problem, but I am avoiding it for other issues, hence my thought to use the Julia REPL to get a clean editor + terminal like experience.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [October 15, 2022, 8:18pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/12 "2022-10-15T20:18:13Z")

</div>

The following Code snippet (paste it into REPL) lets you control the Pkg prompt without changing the original source file. There are still some issues with it, as you can see at the commented code lines, but at this point I let it up to you if you want to follow this path. Actually I am not sure if this is a viable path.

```julia
import Pkg.REPLMode.promptf, Pkg.REPLMode.OFFLINE_MODE, Pkg.REPLMode.prev_project_timestamp, Pkg.REPLMode.prev_prefix, Pkg.REPLMode.prev_project_file, Pkg.REPLMode.projname
import Pkg.Types

function promptf()
    #global prev_project_timestamp, prev_prefix, prev_project_file
    project_file = try
        Types.find_project_file()
    catch
        nothing
    end
    prefix = ""
    if project_file !== nothing
        if prev_project_file == project_file && prev_project_timestamp == mtime(project_file)
            prefix = prev_prefix
        else
            project_name = projname(project_file)
            if project_name !== nothing
                prefix = "($(project_name)) "
                #prev_prefix = prefix
                #prev_project_timestamp = mtime(project_file)
                #prev_project_file = project_file
            end
        end
    end
    if OFFLINE_MODE[]
        prefix = "$(prefix)[offline] "
    end
    #return "$(prefix)pkg> "
    return "$(prefix) "*Base.text_colors[:light_red]*"MyOwnPkgPrompt> "
end

```

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [October 15, 2022, 10:35pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/13 "2022-10-15T22:35:12Z")

</div>

Thank you, oheil. I tried the code out, and the result isn’t quite what I thought it would be from my first look over. There’s the red text I expected, but there’s also blue and some extra space. That’s perfectly fine. I’ll try and figure it all out, learn from it, and then maybe use it. I appreciate your help very much.

---

<div class="post-metadata">

**Author:** ![matw](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@matw](https://discourse.julialang.org/u/matw)\
**Post date:** [December 26, 2022, 9:37pm UTC](https://discourse.julialang.org/t/repl-color-questions-variable-names-seeing-them-and-setting-rgb-values/88743/14 "2022-12-26T21:37:51Z")

</div>

Thanks again for all of your earlier comments and suggestion.

I found a solution this morning that works well and was easy to install: [Windows Terminal](https://github.com/microsoft/terminal).

> Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more.

Upon installing Terminal and running Julia inside it, the REPL is clearly rendered, and the fonts, including the package mode fonts, are easily readable.
