@@ -36,12 +36,13 @@ var catppuccinDark = ansi.StyleConfig{
3636 Italic: boolPtr(true),
3737 Prefix: "┃ ",
3838 },
39− Indent: uintPtr(1),
40− Margin: uintPtr(defaultMargin),
39+ Indent: uintPtr(1),
40+ IndentToken: stringPtr(BaseStyle.Render(" ")),
4141 },
4242 List: ansi.StyleList{
4343 LevelIndent: defaultMargin,
4444 StyleBlock: ansi.StyleBlock{
45+ IndentToken: stringPtr(BaseStyle.Render(" ")),
4546 StylePrimitive: ansi.StylePrimitive{
4647 Color: stringPtr(dark.Text().Hex),
4748 },
@@ -496,3 +497,444 @@ var catppuccinLight = ansi.StyleConfig{
496497 Color: stringPtr(light.Sapphire().Hex),
497498 },
498499}
500+
501+func MarkdownTheme(focused bool) ansi.StyleConfig {
502+ if !focused {
503+ return ASCIIStyleConfig
504+ } else {
505+ return DraculaStyleConfig
506+ }
507+}
508+
509+const (
510+ defaultListIndent = 2
511+ defaultListLevelIndent = 4
512+)
513+
514+var ASCIIStyleConfig = ansi.StyleConfig{
515+ Document: ansi.StyleBlock{
516+ StylePrimitive: ansi.StylePrimitive{
517+ BackgroundColor: stringPtr(Background.Dark),
518+ },
519+ Indent: uintPtr(1),
520+ IndentToken: stringPtr(BaseStyle.Render(" ")),
521+ },
522+ BlockQuote: ansi.StyleBlock{
523+ StylePrimitive: ansi.StylePrimitive{
524+ BackgroundColor: stringPtr(Background.Dark),
525+ },
526+ Indent: uintPtr(1),
527+ IndentToken: stringPtr("| "),
528+ },
529+ Paragraph: ansi.StyleBlock{
530+ StylePrimitive: ansi.StylePrimitive{
531+ BackgroundColor: stringPtr(Background.Dark),
532+ },
533+ },
534+ List: ansi.StyleList{
535+ StyleBlock: ansi.StyleBlock{
536+ IndentToken: stringPtr(BaseStyle.Render(" ")),
537+ StylePrimitive: ansi.StylePrimitive{
538+ BackgroundColor: stringPtr(Background.Dark),
539+ },
540+ },
541+ LevelIndent: defaultListLevelIndent,
542+ },
543+ Heading: ansi.StyleBlock{
544+ StylePrimitive: ansi.StylePrimitive{
545+ BackgroundColor: stringPtr(Background.Dark),
546+ BlockSuffix: "\n",
547+ },
548+ },
549+ H1: ansi.StyleBlock{
550+ StylePrimitive: ansi.StylePrimitive{
551+ BackgroundColor: stringPtr(Background.Dark),
552+ Prefix: "# ",
553+ },
554+ },
555+ H2: ansi.StyleBlock{
556+ StylePrimitive: ansi.StylePrimitive{
557+ BackgroundColor: stringPtr(Background.Dark),
558+ Prefix: "## ",
559+ },
560+ },
561+ H3: ansi.StyleBlock{
562+ StylePrimitive: ansi.StylePrimitive{
563+ BackgroundColor: stringPtr(Background.Dark),
564+ Prefix: "### ",
565+ },
566+ },
567+ H4: ansi.StyleBlock{
568+ StylePrimitive: ansi.StylePrimitive{
569+ BackgroundColor: stringPtr(Background.Dark),
570+ Prefix: "#### ",
571+ },
572+ },
573+ H5: ansi.StyleBlock{
574+ StylePrimitive: ansi.StylePrimitive{
575+ BackgroundColor: stringPtr(Background.Dark),
576+ Prefix: "##### ",
577+ },
578+ },
579+ H6: ansi.StyleBlock{
580+ StylePrimitive: ansi.StylePrimitive{
581+ BackgroundColor: stringPtr(Background.Dark),
582+ Prefix: "###### ",
583+ },
584+ },
585+ Strikethrough: ansi.StylePrimitive{
586+ BackgroundColor: stringPtr(Background.Dark),
587+ BlockPrefix: "~~",
588+ BlockSuffix: "~~",
589+ },
590+ Emph: ansi.StylePrimitive{
591+ BackgroundColor: stringPtr(Background.Dark),
592+ BlockPrefix: "*",
593+ BlockSuffix: "*",
594+ },
595+ Strong: ansi.StylePrimitive{
596+ BackgroundColor: stringPtr(Background.Dark),
597+ BlockPrefix: "**",
598+ BlockSuffix: "**",
599+ },
600+ HorizontalRule: ansi.StylePrimitive{
601+ BackgroundColor: stringPtr(Background.Dark),
602+ Format: "\n--------\n",
603+ },
604+ Item: ansi.StylePrimitive{
605+ BlockPrefix: "• ",
606+ BackgroundColor: stringPtr(Background.Dark),
607+ },
608+ Enumeration: ansi.StylePrimitive{
609+ BlockPrefix: ". ",
610+ BackgroundColor: stringPtr(Background.Dark),
611+ },
612+ Task: ansi.StyleTask{
613+ Ticked: "[x] ",
614+ Unticked: "[ ] ",
615+ StylePrimitive: ansi.StylePrimitive{
616+ BackgroundColor: stringPtr(Background.Dark),
617+ },
618+ },
619+ ImageText: ansi.StylePrimitive{
620+ BackgroundColor: stringPtr(Background.Dark),
621+ Format: "Image: {{.text}} →",
622+ },
623+ Code: ansi.StyleBlock{
624+ StylePrimitive: ansi.StylePrimitive{
625+ BlockPrefix: "`",
626+ BlockSuffix: "`",
627+ BackgroundColor: stringPtr(Background.Dark),
628+ },
629+ },
630+ CodeBlock: ansi.StyleCodeBlock{
631+ StyleBlock: ansi.StyleBlock{
632+ StylePrimitive: ansi.StylePrimitive{
633+ BackgroundColor: stringPtr(Background.Dark),
634+ },
635+ Margin: uintPtr(defaultMargin),
636+ },
637+ },
638+ Table: ansi.StyleTable{
639+ StyleBlock: ansi.StyleBlock{
640+ StylePrimitive: ansi.StylePrimitive{
641+ BackgroundColor: stringPtr(Background.Dark),
642+ },
643+ IndentToken: stringPtr(BaseStyle.Render(" ")),
644+ },
645+ CenterSeparator: stringPtr("|"),
646+ ColumnSeparator: stringPtr("|"),
647+ RowSeparator: stringPtr("-"),
648+ },
649+ DefinitionDescription: ansi.StylePrimitive{
650+ BackgroundColor: stringPtr(Background.Dark),
651+ BlockPrefix: "\n* ",
652+ },
653+}
654+
655+var DraculaStyleConfig = ansi.StyleConfig{
656+ Document: ansi.StyleBlock{
657+ StylePrimitive: ansi.StylePrimitive{
658+ Color: stringPtr(Forground.Dark),
659+ BackgroundColor: stringPtr(Background.Dark),
660+ },
661+ Indent: uintPtr(defaultMargin),
662+ IndentToken: stringPtr(BaseStyle.Render(" ")),
663+ },
664+ BlockQuote: ansi.StyleBlock{
665+ StylePrimitive: ansi.StylePrimitive{
666+ Color: stringPtr("#f1fa8c"),
667+ Italic: boolPtr(true),
668+ BackgroundColor: stringPtr(Background.Dark),
669+ },
670+ Indent: uintPtr(defaultMargin),
671+ IndentToken: stringPtr(BaseStyle.Render(" ")),
672+ },
673+ Paragraph: ansi.StyleBlock{
674+ StylePrimitive: ansi.StylePrimitive{
675+ BackgroundColor: stringPtr(Background.Dark),
676+ },
677+ },
678+ List: ansi.StyleList{
679+ LevelIndent: defaultMargin,
680+ StyleBlock: ansi.StyleBlock{
681+ IndentToken: stringPtr(BaseStyle.Render(" ")),
682+ StylePrimitive: ansi.StylePrimitive{
683+ Color: stringPtr(Forground.Dark),
684+ BackgroundColor: stringPtr(Background.Dark),
685+ },
686+ },
687+ },
688+ Heading: ansi.StyleBlock{
689+ StylePrimitive: ansi.StylePrimitive{
690+ BlockSuffix: "\n",
691+ Color: stringPtr("#bd93f9"),
692+ Bold: boolPtr(true),
693+ BackgroundColor: stringPtr(Background.Dark),
694+ },
695+ },
696+ H1: ansi.StyleBlock{
697+ StylePrimitive: ansi.StylePrimitive{
698+ Prefix: "# ",
699+ BackgroundColor: stringPtr(Background.Dark),
700+ },
701+ },
702+ H2: ansi.StyleBlock{
703+ StylePrimitive: ansi.StylePrimitive{
704+ Prefix: "## ",
705+ BackgroundColor: stringPtr(Background.Dark),
706+ },
707+ },
708+ H3: ansi.StyleBlock{
709+ StylePrimitive: ansi.StylePrimitive{
710+ Prefix: "### ",
711+ BackgroundColor: stringPtr(Background.Dark),
712+ },
713+ },
714+ H4: ansi.StyleBlock{
715+ StylePrimitive: ansi.StylePrimitive{
716+ Prefix: "#### ",
717+ BackgroundColor: stringPtr(Background.Dark),
718+ },
719+ },
720+ H5: ansi.StyleBlock{
721+ StylePrimitive: ansi.StylePrimitive{
722+ Prefix: "##### ",
723+ BackgroundColor: stringPtr(Background.Dark),
724+ },
725+ },
726+ H6: ansi.StyleBlock{
727+ StylePrimitive: ansi.StylePrimitive{
728+ Prefix: "###### ",
729+ BackgroundColor: stringPtr(Background.Dark),
730+ },
731+ },
732+ Strikethrough: ansi.StylePrimitive{
733+ CrossedOut: boolPtr(true),
734+ BackgroundColor: stringPtr(Background.Dark),
735+ },
736+ Emph: ansi.StylePrimitive{
737+ Color: stringPtr("#f1fa8c"),
738+ Italic: boolPtr(true),
739+ BackgroundColor: stringPtr(Background.Dark),
740+ },
741+ Strong: ansi.StylePrimitive{
742+ Bold: boolPtr(true),
743+ Color: stringPtr("#ffb86c"),
744+ BackgroundColor: stringPtr(Background.Dark),
745+ },
746+ HorizontalRule: ansi.StylePrimitive{
747+ Color: stringPtr("#6272A4"),
748+ Format: "\n--------\n",
749+ BackgroundColor: stringPtr(Background.Dark),
750+ },
751+ Item: ansi.StylePrimitive{
752+ BlockPrefix: "• ",
753+ BackgroundColor: stringPtr(Background.Dark),
754+ },
755+ Enumeration: ansi.StylePrimitive{
756+ BlockPrefix: ". ",
757+ Color: stringPtr("#8be9fd"),
758+ BackgroundColor: stringPtr(Background.Dark),
759+ },
760+ Task: ansi.StyleTask{
761+ StylePrimitive: ansi.StylePrimitive{
762+ BackgroundColor: stringPtr(Background.Dark),
763+ },
764+ Ticked: "[✓] ",
765+ Unticked: "[ ] ",
766+ },
767+ Link: ansi.StylePrimitive{
768+ Color: stringPtr("#8be9fd"),
769+ Underline: boolPtr(true),
770+ BackgroundColor: stringPtr(Background.Dark),
771+ },
772+ LinkText: ansi.StylePrimitive{
773+ Color: stringPtr("#ff79c6"),
774+ BackgroundColor: stringPtr(Background.Dark),
775+ },
776+ Image: ansi.StylePrimitive{
777+ Color: stringPtr("#8be9fd"),
778+ Underline: boolPtr(true),
779+ BackgroundColor: stringPtr(Background.Dark),
780+ },
781+ ImageText: ansi.StylePrimitive{
782+ Color: stringPtr("#ff79c6"),
783+ Format: "Image: {{.text}} →",
784+ BackgroundColor: stringPtr(Background.Dark),
785+ },
786+ Code: ansi.StyleBlock{
787+ StylePrimitive: ansi.StylePrimitive{
788+ Color: stringPtr("#50fa7b"),
789+ BackgroundColor: stringPtr(Background.Dark),
790+ },
791+ },
792+ Text: ansi.StylePrimitive{
793+ BackgroundColor: stringPtr(Background.Dark),
794+ },
795+ DefinitionList: ansi.StyleBlock{},
796+ CodeBlock: ansi.StyleCodeBlock{
797+ StyleBlock: ansi.StyleBlock{
798+ StylePrimitive: ansi.StylePrimitive{
799+ Color: stringPtr("#ffb86c"),
800+ BackgroundColor: stringPtr(Background.Dark),
801+ },
802+ Margin: uintPtr(defaultMargin),
803+ },
804+ Chroma: &ansi.Chroma{
805+ NameOther: ansi.StylePrimitive{
806+ BackgroundColor: stringPtr(Background.Dark),
807+ },
808+ Literal: ansi.StylePrimitive{
809+ BackgroundColor: stringPtr(Background.Dark),
810+ },
811+ NameException: ansi.StylePrimitive{
812+ BackgroundColor: stringPtr(Background.Dark),
813+ },
814+ LiteralDate: ansi.StylePrimitive{
815+ BackgroundColor: stringPtr(Background.Dark),
816+ },
817+ Text: ansi.StylePrimitive{
818+ Color: stringPtr(Forground.Dark),
819+ BackgroundColor: stringPtr(Background.Dark),
820+ },
821+ Error: ansi.StylePrimitive{
822+ Color: stringPtr("#f8f8f2"),
823+ BackgroundColor: stringPtr("#ff5555"),
824+ },
825+ Comment: ansi.StylePrimitive{
826+ Color: stringPtr("#6272A4"),
827+ BackgroundColor: stringPtr(Background.Dark),
828+ },
829+ CommentPreproc: ansi.StylePrimitive{
830+ Color: stringPtr("#ff79c6"),
831+ BackgroundColor: stringPtr(Background.Dark),
832+ },
833+ Keyword: ansi.StylePrimitive{
834+ Color: stringPtr("#ff79c6"),
835+ BackgroundColor: stringPtr(Background.Dark),
836+ },
837+ KeywordReserved: ansi.StylePrimitive{
838+ Color: stringPtr("#ff79c6"),
839+ BackgroundColor: stringPtr(Background.Dark),
840+ },
841+ KeywordNamespace: ansi.StylePrimitive{
842+ Color: stringPtr("#ff79c6"),
843+ BackgroundColor: stringPtr(Background.Dark),
844+ },
845+ KeywordType: ansi.StylePrimitive{
846+ Color: stringPtr("#8be9fd"),
847+ BackgroundColor: stringPtr(Background.Dark),
848+ },
849+ Operator: ansi.StylePrimitive{
850+ Color: stringPtr("#ff79c6"),
851+ BackgroundColor: stringPtr(Background.Dark),
852+ },
853+ Punctuation: ansi.StylePrimitive{
854+ Color: stringPtr(Forground.Dark),
855+ BackgroundColor: stringPtr(Background.Dark),
856+ },
857+ Name: ansi.StylePrimitive{
858+ Color: stringPtr("#8be9fd"),
859+ BackgroundColor: stringPtr(Background.Dark),
860+ },
861+ NameBuiltin: ansi.StylePrimitive{
862+ Color: stringPtr("#8be9fd"),
863+ BackgroundColor: stringPtr(Background.Dark),
864+ },
865+ NameTag: ansi.StylePrimitive{
866+ Color: stringPtr("#ff79c6"),
867+ BackgroundColor: stringPtr(Background.Dark),
868+ },
869+ NameAttribute: ansi.StylePrimitive{
870+ Color: stringPtr("#50fa7b"),
871+ BackgroundColor: stringPtr(Background.Dark),
872+ },
873+ NameClass: ansi.StylePrimitive{
874+ Color: stringPtr("#8be9fd"),
875+ BackgroundColor: stringPtr(Background.Dark),
876+ },
877+ NameConstant: ansi.StylePrimitive{
878+ Color: stringPtr("#bd93f9"),
879+ BackgroundColor: stringPtr(Background.Dark),
880+ },
881+ NameDecorator: ansi.StylePrimitive{
882+ Color: stringPtr("#50fa7b"),
883+ BackgroundColor: stringPtr(Background.Dark),
884+ },
885+ NameFunction: ansi.StylePrimitive{
886+ Color: stringPtr("#50fa7b"),
887+ BackgroundColor: stringPtr(Background.Dark),
888+ },
889+ LiteralNumber: ansi.StylePrimitive{
890+ Color: stringPtr("#6EEFC0"),
891+ BackgroundColor: stringPtr(Background.Dark),
892+ },
893+ LiteralString: ansi.StylePrimitive{
894+ Color: stringPtr("#f1fa8c"),
895+ BackgroundColor: stringPtr(Background.Dark),
896+ },
897+ LiteralStringEscape: ansi.StylePrimitive{
898+ Color: stringPtr("#ff79c6"),
899+ BackgroundColor: stringPtr(Background.Dark),
900+ },
901+ GenericDeleted: ansi.StylePrimitive{
902+ Color: stringPtr("#ff5555"),
903+ BackgroundColor: stringPtr(Background.Dark),
904+ },
905+ GenericEmph: ansi.StylePrimitive{
906+ Color: stringPtr("#f1fa8c"),
907+ Italic: boolPtr(true),
908+ BackgroundColor: stringPtr(Background.Dark),
909+ },
910+ GenericInserted: ansi.StylePrimitive{
911+ Color: stringPtr("#50fa7b"),
912+ BackgroundColor: stringPtr(Background.Dark),
913+ },
914+ GenericStrong: ansi.StylePrimitive{
915+ Color: stringPtr("#ffb86c"),
916+ Bold: boolPtr(true),
917+ BackgroundColor: stringPtr(Background.Dark),
918+ },
919+ GenericSubheading: ansi.StylePrimitive{
920+ Color: stringPtr("#bd93f9"),
921+ BackgroundColor: stringPtr(Background.Dark),
922+ },
923+ Background: ansi.StylePrimitive{
924+ BackgroundColor: stringPtr(Background.Dark),
925+ },
926+ },
927+ },
928+ Table: ansi.StyleTable{
929+ StyleBlock: ansi.StyleBlock{
930+ StylePrimitive: ansi.StylePrimitive{
931+ BackgroundColor: stringPtr(Background.Dark),
932+ },
933+ IndentToken: stringPtr(BaseStyle.Render(" ")),
934+ },
935+ },
936+ DefinitionDescription: ansi.StylePrimitive{
937+ BlockPrefix: "\n* ",
938+ BackgroundColor: stringPtr(Background.Dark),
939+ },
940+}