Skip to content

Instantly share code, notes, and snippets.

@olekstomek
Created November 12, 2021 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olekstomek/af9e8d72a101b8bf4a262e4de4c9618d to your computer and use it in GitHub Desktop.
Save olekstomek/af9e8d72a101b8bf4a262e4de4c9618d to your computer and use it in GitHub Desktop.
program ColorPicker;
uses crt;
const
QuitKey = #27;
PrevKey = #75;
NextKey = #77;
var
Picked : byte;
Quit : boolean;
FuncKey : char;
I : shortint;
begin
Quit:=false;
Picked:=0;
repeat
clrscr;
textcolor(Picked);
for I:=1 to 8 do
write(#219);
textcolor(7);
writeln('=',Picked);
writeln(' Arrows and numbers to pick, ESC to quit.');
writeln(' Programmed by Jan "Manna5" Mleczko.');
FuncKey:=readkey;
if FuncKey=QuitKey then
Quit:=true
else
if (FuncKey >= '0') and (FuncKey <= '9') then
Picked:=ord(FuncKey)-48
else if (FuncKey >= 'a') and (FuncKey <= 'f') then
Picked:=ord(FuncKey)-87
else
if FuncKey=#0 then
begin
FuncKey:=readkey;
case FuncKey of
NextKey : if Picked < 15 then
inc(Picked);
PrevKey : if Picked > 0 then
dec(Picked);
end;
end;
until Quit;
clrscr;
end.
@olekstomek
Copy link
Author

olekstomek commented Nov 12, 2021

Autor: Manna5
https://4programmers.net/Mikroblogi/View/113780

image

Narzędzie to wyboru kolorów (color picker)
Aplikacja napisana w Pascalu. Można przeglądać dostępne kolory za pomocą strzałek i cyfr (szesnastkowych), wyświetlany jest pasek w danym kolorze o szerokości ośmiu znaków oraz kod koloru tym razem w systemie dziesiętnym. Kod ma tylko 49 linii i jest umieszczony poniżej.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment