MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / Style_StrGetColor

Function Style_StrGetColor

src/Styles.c:2510–2533  ·  view source on GitHub ↗

============================================================================= Style_StrGetColor()

Source from the content-addressed store, hash-verified

2508// Style_StrGetColor()
2509//
2510BOOL Style_StrGetColor ( BOOL bFore, LPCWSTR lpszStyle, int *rgb )
2511{
2512 WCHAR tch[256];
2513 WCHAR *p;
2514 int iValue;
2515 int itok;
2516 WCHAR *pItem = ( bFore ) ? L"fore:" : L"back:";
2517 if ( p = StrStrI ( lpszStyle, pItem ) ) {
2518 lstrcpy ( tch, p + lstrlen ( pItem ) );
2519 if ( tch[0] == L'#' ) {
2520 tch[0] = L' ';
2521 }
2522 if ( p = StrChr ( tch, L';' ) ) {
2523 *p = L'\0';
2524 }
2525 TrimString ( tch );
2526 itok = swscanf ( tch, L"%x", &iValue );
2527 if ( itok == 1 ) {
2528 *rgb = RGB ( ( iValue & 0xFF0000 ) >> 16, ( iValue & 0xFF00 ) >> 8, iValue & 0xFF );
2529 return TRUE;
2530 }
2531 }
2532 return FALSE;
2533}
2534
2535
2536//=============================================================================

Callers 7

Style_SetLexerFunction · 0.85
Style_SetLongLineColorsFunction · 0.85
Style_SelectFontFunction · 0.85
Style_SelectColorFunction · 0.85
Style_SetStylesFunction · 0.85
Style_ConfigDlgProcFunction · 0.85

Calls 1

TrimStringFunction · 0.85

Tested by

no test coverage detected