⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 color.c

📁 PocketCMD是与pocketconsole配合实用的命令行解释器(Shell)
💻 C
字号:
/* $Id: color.c,v 1.1.1.1 2004/02/15 23:24:43 pfalcon Exp $ * *  COLOR.C - color internal command. * * *  History: * *    13-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) *        Started. * *    19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) *        Unicode ready! * *    20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) *        Redirection ready! * *    14-Oct-1999 (Paolo Pantaleo <paolopan@freemail.it>) *        4nt's syntax implemented */#include "config.h"#ifdef INCLUDE_CMD_COLOR#include "cmd.h"static VOID ColorHelp (VOID){		ConOutPuts (			_T("Sets the default foreground and background colors.\n")			_T("\n")			_T("COLOR [attr [/F]] \n\n")			_T("  attr        Specifies color attribute of console output\n")			_T("  /F          fill the console with color attribute\n")			_T("\n"			)			_T("There are three ways to specify the colors:")			);		ConOutPuts (			_T("\n")			_T("1) [bright] name on [bright] name  (only the first three letters are required)\n")			_T("2) decimal on decimal\n")			_T("3) two hex digits\n")			_T("\n")			_T("Colors are:")			);		ConOutPuts (			_T("dec  hex  name       dec  hex  name\n")			_T("0    0    Black       8   8    Gray(Bright black)\n")			_T("1    1    Blue        9   9    Bright Blue\n")			_T("2    2    Green      10   A    Bright Green\n")			_T("3    3    Cyan       11   B    Bright Cyan\n")			_T("4    4    Red        12   C    Bright Red\n")			_T("5    5    Magenta    13   D    Bright Magenta\n")			_T("6    6    Yellow     14   E    Bright Yellow\n")			_T("7    7    White      15   F    Bright White")			);}VOID SetScreenColor (WORD wColor, BOOL bFill){	DWORD dwWritten;	CONSOLE_SCREEN_BUFFER_INFO csbi;	COORD coPos;	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);	if (bFill == TRUE)	{		GetConsoleScreenBufferInfo (hOut, &csbi);		coPos.X = 0;		coPos.Y = 0;		FillConsoleOutputAttribute (hOut,		                            (WORD)(wColor & 0x00FF),		                            (csbi.dwSize.X)*(csbi.dwSize.Y),		                            coPos,		                            &dwWritten);	}	SetConsoleTextAttribute (hOut, (WORD)(wColor & 0x00FF));}/* * color * * internal dir command */INT CommandColor (LPTSTR first, LPTSTR rest){	if (_tcsncmp (rest, _T("/?"), 2) == 0)	{		ColorHelp ();		return 0;	}	if (rest[0] == _T('\0'))	{		/* set default color */		wColor = wDefColor;		SetScreenColor (wColor, TRUE);		return 0;	}	if (StringToColor (&wColor, &rest) == FALSE)	{		ConErrPuts(_T("error in color specification"));		return 1;	}	ConErrPrintf (_T("Color %x\n"), wColor);	if ((wColor & 0xF) == (wColor &0xF0) >> 4)	{		ConErrPuts (_T("same colors error!"));		return 1;	}	/* set color */	SetScreenColor (wColor,	                (_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f"))));	return 0;}#endif /* INCLUDE_CMD_COLOR *//* EOF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -