From 9c95aa25d1351f22ebb4a7275b08f1a885db6054 Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 29 Dec 2022 00:06:53 -0800 Subject: [PATCH] colorize prompt for remotes --- src/main.tsx | 7 +++++-- src/sh2.less | 36 ++++++++++++++++++++++++++++++++++++ src/types.ts | 5 +++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index f358ea68..1eebcee2 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -205,9 +205,12 @@ class Prompt extends React.Component<{rptr : RemotePtrType, festate : FeStateTyp isRoot = true; } } - let className = (isRoot ? "term-bright-red" : "term-bright-green"); + let colorClass = (isRoot ? "color-red" : "color-green"); + if (remote && remote.remoteopts && remote.remoteopts.color) { + colorClass = "color-" + remote.remoteopts.color; + } return ( - [{remoteStr}] {cwd} {isRoot ? "#" : "$"} + [{remoteStr}] {cwd} {isRoot ? "#" : "$"} ); } } diff --git a/src/sh2.less b/src/sh2.less index 647e9aad..00dbc1d7 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -1248,6 +1248,42 @@ input[type=checkbox] { color: @term-bright-red; } +#main .term-prompt { + color: @term-bright-green; + + &.color-green { + color: @term-bright-green; + } + + &.color-red { + color: @term-bright-red; + } + + &.color-blue { + color: @term-bright-blue; + } + + &.color-yellow { + color: @term-bright-yellow; + } + + &.color-magenta { + color: @term-bright-magenta; + } + + &.color-cyan { + color: @term-bright-cyan; + } + + &.color-white { + color: @term-bright-white; + } + + &.color-orange { + color: @tab-orange; + } +} + #main .screen-tabs .screen-tab { &.color-green { color: @tab-black-text; diff --git a/src/types.ts b/src/types.ts index c394ac35..04befdf0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -80,6 +80,10 @@ type ScreenWindowType = { remove? : boolean, }; +type RemoteOptsType = { + color : string, +}; + type RemoteType = { remotetype : string, remoteid : string, @@ -100,6 +104,7 @@ type RemoteType = { mshellversion : string, needsmshellupgrade : boolean, waitingforpassword : boolean, + remoteopts? : RemoteOptsType, local : boolean, remove? : boolean, };