Sunday, May 27, 2018

HP Prime Colors (English and Spanish)


HP Prime Colors (English and Spanish)



Introduction

The program COLORES lets the user scroll through various colors (black/blanco, gray/gris, white/blanco, etc.) using the plus ( [+] ) and minus ( [ -] ) buttons.  End the program while pressing the escape button ([Esc]). 

That’s all there is to it.  Enjoy this program. 

HP Prime Program COLORES

drawnow(); // subroutine

EXPORT COLORES()
BEGIN
// 2018-05-27 EWS
// Colors in English and Spanish

// initialization
LOCAL i:=0,j:=1;
LOCAL lst:={{0,"black","negro"},
{#808080h,"gray","gris"},
{#FFFFFFh,"white","blanco"},
{#FF0000h,"red","rojo"},
{#800000h,"maroon","granate"},
{#FFC0C0h,"pink","rosado"},
{#FF00FFh,"magenta","magenta"},
{#400080h,"indigo","índigo"},
{#800080h,"purple","púrpura"},
{#000080h,"navy blue","azul marino"},
{#0000FFh,"blue","azul"},
{#00FFFFh,"cyan","cian"},
{#80D0FFh,"sky blue","cielo azul"},
{#008080h,"teal","verde azulado"},
{#003000h,"fir green","abeto verde"},
{#008000h,"green","verde"},
{#00FF00h,"lime","lima"},
{#FF8000h,"orange","naranja"},
{#D0B090h,"tan","bronceado"},
{#FFFF00h,"yellow","amarillo"}
};
LOCAL s:=SIZE(lst);

RECT();
TEXTOUT_P("Press [+] or [-] to start.",
10,45,4);

LOCAL k,j1,j2,j3;
REPEAT
k:=GETKEY;

// plus key
IF k==50 THEN
i:=i+1; j:=(i MOD s)+1;
j1:=lst(j,1); j2:=lst(j,2);
j3:=lst(j,3);
drawnow(j1,j2,j3);
END;

// minus key
IF k==45 THEN
i:=i-1; j:=(i MOD s)+1;
j1:=lst(j,1); j2:=lst(j,2);
j3:=lst(j,3);
drawnow(j1,j2,j3);
END;


UNTIL k=4; // ESC key
END;

// subroutine
drawnow(x1,x2,x3)
BEGIN
RECT();
// polygon
FILLPOLY_P({{10,10},{10,150},{150,150},
{150,10}},x1);
// text
TEXTOUT_P("English:",160,20,4);
TEXTOUT_P(x2,160,40,4);
TEXTOUT_P("Español:",160,70,4);
TEXTOUT_P(x3,160,90,4);
END;

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.