@@ -506,6 +506,40 @@ func drawBorder(layerEntry *memory.LayerEntryType, styleEntry memory.TuiStyleEnt
506506 drawFrame (layerEntry , styleEntry , localAttributeEntry , constants .FrameStyleNormal , xLocation , yLocation , width , height )
507507}
508508
509+ /*
510+ DrawFrameLabel allows you to draw a label for a frame. The label will
511+ be automatically enclosed by the characters "[" and "]" to blend in
512+ with a border of a frame.
513+
514+ - If the frame label to be drawn falls outside the range of the
515+ specified layer, then only the visible portion of the border will be
516+ drawn.
517+ */
518+ func DrawFrameLabel (layerAlias string , styleEntry memory.TuiStyleEntryType , label string , xLocation int , yLocation int ) {
519+ layerEntry := memory .GetLayer (layerAlias )
520+ drawFrameLabel (layerEntry , styleEntry , label , xLocation , yLocation )
521+ }
522+
523+ /*
524+ DrawFrameLabel allows you to draw a label for a frame. The label will
525+ be automatically enclosed by the characters "[" and "]" to blend in
526+ with a border of a frame.
527+
528+ - If the frame label to be drawn falls outside the range of the
529+ specified layer, then only the visible portion of the border will be
530+ drawn.
531+ */
532+ func drawFrameLabel (layerEntry * memory.LayerEntryType , styleEntry memory.TuiStyleEntryType , label string , xLocation int , yLocation int ) {
533+ attributeEntry := memory .NewAttributeEntry ()
534+ attributeEntry .ForegroundColor = styleEntry .TextForegroundColor
535+ attributeEntry .BackgroundColor = styleEntry .TextBackgroundColor
536+ printLayer (layerEntry , attributeEntry , xLocation , yLocation , []rune ("[ " ))
537+ printLayer (layerEntry , attributeEntry , xLocation + 2 + len (label ), yLocation , []rune (" ]" ))
538+ attributeEntry .ForegroundColor = styleEntry .TextLabelColor
539+ attributeEntry .BackgroundColor = styleEntry .TextBackgroundColor
540+ printLayer (layerEntry , attributeEntry , xLocation + 2 , yLocation , []rune (label ))
541+ }
542+
509543/*
510544DrawFrame allows you to draw a frame on a given text layer. Frames differ
511545from borders since borders are flat shaded and do not have a raised or
0 commit comments