SQLcl: set color in sqlprompt (ANSI/VT100 Control sequences)
From above link I created a Java Script in sqlcli bin directory(on windows 10)

C:\sqlcl-19.2.1.246.1707\sqlcl\bin&gt;type PromptColor.js
//file name PromptColor.js save in sqlcli bin dir
//login sqlcli and run script PromptColor.js
var dbUser = util.executeReturnOneCol('select user from sys.dual');
if ( dbUser == 'HR' )
  {
   sqlcl.setStmt('set sqlprompt "@|red _USER|@@@|red _CONNECT_IDENTIFIER|@@|red &gt;|@"');
  }
else if ( dbUser == 'SOE')
  {
    sqlcl.setStmt('set sqlprompt "@|green _USER|@@@|green _CONNECT_IDENTIFIER|@@|green &gt;|@"');
  }

else
  {
    sqlcl.setStmt('set sqlprompt "@|blue _USER|@@@|blue _CONNECT_IDENTIFIER|@@|blue &gt;|@"');
  }


sqlcl.run();


login with default prompt 

C:\sqlcl-19.2.1.246.1707\sqlcl\bin&gt;sql soe/soe@localhost:1521/orclpdb.localdomain -- pdb database 

SQLcl: Release 19.2.1 Production on Tue Nov 12 12:17:13 2019

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL&gt;script PromptColor.js




Next is to figure how to call javascript from login.sql

Edit:- create a sql file with single line script PromptColor.js place in SQLPATH directory and add that sqlfile name in login.sql it automatically changes color based on user logged in