Package: coloredmatrix
Colored MatrixA Python library for changing the colors in the terminal using ANSI escape codes.InstallationTo install Colored Matrix, usepip:pipinstallcoloredmatrixUsageTo use Colored Matrix, import the Stylize class and the Color constants, and call the desired methods on a Stylize object:fromcoloredmatriximportStylize,Color# Set the background color to greenprint(Stylize("hello").bg_color(Color.Green))# Set the background color to redprint(Stylize("hello").bg_color(Color.Red))# Set the background color to green and the foreground color to redprint(Stylize("hello").bg_color(Color.Green).fg_color(Color.Red))# Set the text to bold and underlinedprint(Stylize("hello").bold().underline())You can also pass an RGB color tuple to the bg_color and fg_color methods:fromcoloredmatriximportStylize# Set the background color to red using an RGB color tupleprint(Stylize("hello").bg_color((255,0,0)))# Set the background color to green using an RGB color tupleprint(Stylize("hello").bg_color((0,255,0)))# Set the background color to red and the foreground color to green using RGB color tuplesprint(Stylize("hello").bg_color((255,0,0)).fg_color((0,255,0)))Text StylingTheStylizeclass provides the following methods for styling text:bold: Makes the text bolditalic: Makes the text italicunderline: Underlines the textblink: Makes the text blinkstrike: Strikes through the textYou can chain these methods to apply multiple styles to the same text. For example:fromcoloredmatriximportStylize# Set the text to bold, italic, and underlinedprint(Stylize("hello").bold().italic().underline())# Set the text to blink and struck throughprint(Stylize("hello").blink().strike())Supported ColorsYou can also use RGB color tuples to specify any other color.TheColorconstants define the following colors:Color NameColor NameColor NameColor NameColor NameMediumVioletRedDeepPinkPaleVioletRedHotPinkLightPinkPinkDarkRedRedFirebrickCrimsonIndianRedLightCoralSalmonDarkSalmonLightSalmonOrangeRedTomatoDarkOrangeCoralOrangeDarkKhakiGoldKhakiPeachPuffYellowPaleGoldenrodMoccasinPapayaWhipLightGoldenrodYellowLemonChiffonLightYellowMaroonBrownSaddleBrownSiennaChocolateDarkGoldenrodPeruRosyBrownGoldenrodSandyBrownTanBurlywoodWheatNavajoWhiteBisqueBlanchedAlmondCornsilkIndigoPurpleDarkMagentaDarkVioletDarkSlateBlueBlueVioletDarkOrchidFuchsiaMagentaSlateBlueMediumSlateBlueMediumOrchidMediumPurpleOrchidVioletPlumThistleLavenderMidnightBlueNavyDarkBlueMediumBlueBlueRoyalBlueSteelBlueDodgerBlueDeepSkyBlueCornflowerBlueSkyBlueLightSkyBlueLightSteelBlueLightBluePowderBlueTealDarkCyanLightSeaGreenCadetBlueDarkTurquoiseMediumTurquoiseTurquoiseAquaCyanAquamarinePaleTurquoiseLightCyanDarkGreenGreenDarkOliveGreenForestGreenSeaGreenOliveOliveDrabMediumSeaGreenLimeGreenLimeSpringGreenMediumSpringGreenDarkSeaGreenMediumAquamarineYellowGreenLawnGreenChartreuseLightGreenGreenYellowPaleGreenMistyRoseAntiqueWhiteLinenBeigeWhiteSmokeLavenderBlushOldLaceAliceBlueSeashellGhostWhiteHoneydewFloralWhiteAzureMintCreamSnowIvoryWhiteBlackDarkSlateGrayDimGraySlateGrayGrayLightSlateGrayDarkGraySilverLightGrayGainsboroLicenseLicense
Colored Matrix is released under the MIT License. See theLICENSEfile for more information.