# Is any way to print DataFrames using heat maps as background?

**URL:** <https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744>\
**Category:** General Usage\
**Tags:** dataframes, vscode, notebooks, prettytables\
**Created:** [March 11, 2022, 11:36am UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744 "2022-03-11T11:36:26Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![Dan\_Micsa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan_micsa/32/30233_2.png) [@Dan\_Micsa](https://discourse.julialang.org/u/Dan_Micsa)\
**Post date:** [March 13, 2022, 3:45pm UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/42 "2022-03-13T15:45:29Z")

</div>

Thank you again for our (futile) struggle!

As bonus two color schemes. 🙂

```julia
csSolarizedDivergent = ColorScheme([Colors.RGB(0xdc322f), Colors.RGB(0xfdf6e3), Colors.RGB(0x859900)])
    
csSolarizedMono = ColorScheme([Colors.RGB(0x002b36), Colors.RGB(0x657b83), Colors.RGB(0xfdf6e3)])

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 13, 2022, 6:17pm UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/43 "2022-03-13T18:17:44Z")

</div>

Because I’m seeing those green ticks with the timing indicator next to this, is this actually Jupyter notebook in VSCode rather than the terminal in VSCode?

---

<div class="post-metadata">

**Author:** ![Dan\_Micsa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan_micsa/32/30233_2.png) [@Dan\_Micsa](https://discourse.julialang.org/u/Dan_Micsa)\
**Post date:** [March 13, 2022, 8:45pm UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/44 "2022-03-13T20:45:33Z")

</div>

I’m a newby and clueless. What I understend is the code that has the “m\e[” insted of “;” works correctly both in console and VSCode.Jupyter

```julia
println("\e[38;2;255;255;0;48;2;0;0;255mThis must have blue background\e[0m")
println("\e[38;2;255;255;0m\e[48;2;0;0;255mThis must have blue background\e[0m")

```

however in Chrome.Jupyter and console it works OK

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/4/b4bed27ae9562623261467c39938b1746240ed3f.png)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/5/e5371c91c5a8e7af914b36ebe676e1d76a744811.png)

---

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [March 14, 2022, 1:43pm UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/45 "2022-03-14T13:43:20Z")

</div>

Hi,  
I am looking for a documentation that explain the syntax

`println("\e[`

used in this post.  
Thanks 🙂

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 14, 2022, 1:56pm UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/46 "2022-03-14T13:56:06Z")

</div>

> **[ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code)**
>
> ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as commands, rather than text to display verbatim.
> ANSI sequences were introduced in the 1970s to replace vendor-specific sequences and became widespread in the ...

---

<div class="post-metadata">

**Author:** ![Dan\_Micsa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan_micsa/32/30233_2.png) [@Dan\_Micsa](https://discourse.julialang.org/u/Dan_Micsa)\
**Post date:** [March 16, 2022, 9:16am UTC](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744/47 "2022-03-16T09:16:44Z")

</div>

I wrote some utilities to encapsulate the setting of foreground and background colors for consoles. Tested on Win10.

```julia
module CS
u2c(v)::UInt8 = round(clamp(v, 0, 1) * 255)
c2s(RGB) = "$(u2c(RGB.r));$(u2c(RGB.g));$(u2c(RGB.b))"

fc(c::RGB) = "\e[38;2;$(c2s(c))m" #set foreground color
bc(c::RGB) = "\e[48;2;$(c2s(c))m" #set background color
fc(c) = "\e[38;5;$(clamp(c,0,255))m" #set foreground color
bc(c) = "\e[48;5;$(clamp(c,0,255))m" #set background color
fb0() = "\e[0m" #reset foreground and background color
end

for v in 0:15 print("$(CS.fc(16-v))$(CS.bc(v))*") end; println(CS.fb0())
for v in 0:15 print("$(CS.fc(v))*") end; println(CS.fb0())
for v in 0:15 print("$(CS.bc(v))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.fc(RGB(v,v,0)))$(CS.bc(RGB(0,v,0)))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.fc(RGB(v,v,0)))*") end; println(CS.fb0())
for v in 0:1/16:0.99 print("$(CS.bc(RGB(0,v,0)))*") end; println(CS.fb0())

```

![image](https://global.discourse-cdn.com/julialang/original/3X/7/1/718a1badf42099f9440a63c80b54de2854934f43.png)

[Previous page](https://discourse.julialang.org/t/is-any-way-to-print-dataframes-using-heat-maps-as-background/77744.md?page=2)
