/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : Colors.pkg */ /* Version : 20 juin 2000 */ /* Scs Color based utility functions */ /* */ /***************************************************************************************/ fun revertColor( colorString )= let substr colorString 0 2 -> blue in let substr colorString 2 2 -> green in let substr colorString 4 2 -> red in strcatn red::green::blue::nil ;; fun buildZeros( number )= if number == 0 then nil else strcat "0" buildZeros number - 1 ;; /*************************************************************************************** * * Converts an HTML style color to a Scol style color * * entry format : "#FFFFFF" * exit format : I * ***************************************************************************************/ fun colorHTMLtoSCOL( colorString )= /* test format */ if ((nth_char colorString 0) != '#) || (strlen colorString) != 7 then htoi revertColor substr colorString 0 6 else htoi revertColor substr colorString 1 6 ;; /*************************************************************************************** * * Converts a Scol style color to an HTML style color * * entry format : I * exit format : "#FFFFFF" * ***************************************************************************************/ fun colorSCOLtoHTML( color )= let struppercase itoh color -> colorPostfix in strcat "#" revertColor strcatn (buildZeros 6 - strlen colorPostfix)::colorPostfix::nil ;;