HP Forums
Colors: English/Spanish - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Colors: English/Spanish (/thread-10808.html)



Colors: English/Spanish - Eddie W. Shore - 05-28-2018 01:57 AM

Link to blog post: https://edspi31415.blogspot.com/2018/05/hp-prime-colors-english-and-spanish.html

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
Code:

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;