Skip to content

Commit

Permalink
imp - Disco mode is now more colorful!
Browse files Browse the repository at this point in the history
---

We've make the Disco mode more colorful by making all the boxes in the main page change their color!

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 19, 2024
1 parent 086d730 commit 3d5839d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion BassBoom.Cli/CliBase/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public static void PlayerLoop()
if (Common.CurrentCachedInfo is null)
return "";
var buffer = new StringBuilder();
string name = PlayerControls.RenderSongName(Common.CurrentCachedInfo.MusicPath);
int startPos = 4;
int endPos = ConsoleWrapper.WindowHeight - 5;
int songsPerPage = endPos - startPos;
position = FileTools.IsOpened(BassBoomCli.basolia) ? PlaybackPositioningTools.GetCurrentDuration(BassBoomCli.basolia) : 0;
var posSpan = FileTools.IsOpened(BassBoomCli.basolia) ? PlaybackPositioningTools.GetCurrentDurationSpan(BassBoomCli.basolia) : new();
var disco = PlaybackTools.IsPlaying(BassBoomCli.basolia) && Common.enableDisco ? new Color($"hsl:{hue};50;50") : BassBoomCli.white;
Expand All @@ -121,10 +125,11 @@ public static void PlayerLoop()
string boostIndicator = Common.volBoost ? new Color(ConsoleColors.Red).VTSequenceForeground : "";
string indicator =
$"┤ Seek: {PlayerControls.seekRate:0.00} | " +
$"{boostIndicator}Volume: {Common.volume * 100:0}%{ColorTools.RenderResetForeground()}";
$"{boostIndicator}Volume: {Common.volume * 100:0}%{disco.VTSequenceForeground}";
string lyric = Common.CurrentCachedInfo.LyricInstance is not null ? Common.CurrentCachedInfo.LyricInstance.GetLastLineCurrent(BassBoomCli.basolia) : "";
string finalLyric = string.IsNullOrWhiteSpace(lyric) ? "..." : lyric;
buffer.Append(
BoxFrameColor.RenderBoxFrame(name, 2, 1, ConsoleWrapper.WindowWidth - 6, songsPerPage, disco) +
ProgressBarColor.RenderProgress(100 * (position / (double)Common.CurrentCachedInfo.Duration), 2, ConsoleWrapper.WindowHeight - 5, ConsoleWrapper.WindowWidth - 6, disco, disco) +
TextWriterWhereColor.RenderWhereColor($"{posSpan} / {Common.CurrentCachedInfo.DurationSpan}", 4, ConsoleWrapper.WindowHeight - 5, disco) +
TextWriterWhereColor.RenderWhereColor(indicator, ConsoleWrapper.WindowWidth - ConsoleChar.EstimateCellWidth(indicator) - 4, ConsoleWrapper.WindowHeight - 5, disco) +
Expand Down
12 changes: 8 additions & 4 deletions BassBoom.Cli/CliBase/Radio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,23 @@ public static void RadioLoop()
{
if (Common.CurrentCachedInfo is null)
return "";
string name = RadioControls.RenderStationName();
int startPos = 4;
int endPos = ConsoleWrapper.WindowHeight - 1;
int stationsPerPage = endPos - startPos;
var buffer = new StringBuilder();
string boostIndicator = Common.volBoost ? new Color(ConsoleColors.Red).VTSequenceForeground : "";
string indicator = $"{boostIndicator}Volume: {Common.volume * 100:0}%{ColorTools.RenderResetForeground()}";
var disco = PlaybackTools.IsPlaying(BassBoomCli.basolia) && Common.enableDisco ? new Color($"hsl:{hue};50;50") : BassBoomCli.white;
string indicator = $"{boostIndicator}Volume: {Common.volume * 100:0}%{disco.VTSequenceForeground}";
if (PlaybackTools.IsPlaying(BassBoomCli.basolia))
{
hue++;
if (hue >= 360)
hue = 0;
}
buffer.Append(
BoxFrameColor.RenderBoxFrame(2, ConsoleWrapper.WindowHeight - 5, ConsoleWrapper.WindowWidth - 6, 1, disco) +
TextWriterWhereColor.RenderWhereColor(indicator, ConsoleWrapper.WindowWidth - ConsoleChar.EstimateCellWidth(indicator) - 4, ConsoleWrapper.WindowHeight - 5, disco)
BoxFrameColor.RenderBoxFrame(name, 2, 1, ConsoleWrapper.WindowWidth - 6, stationsPerPage, disco) +
TextWriterWhereColor.RenderWhereColor(indicator, ConsoleWrapper.WindowWidth - ConsoleChar.EstimateCellWidth(indicator) - 4, ConsoleWrapper.WindowHeight - 3, disco)
);
return buffer.ToString();
});
Expand Down Expand Up @@ -323,7 +327,7 @@ private static string HandleDraw()
// Now, print the list of stations.
var choices = new List<InputChoiceInfo>();
int startPos = 4;
int endPos = ConsoleWrapper.WindowHeight - 5;
int endPos = ConsoleWrapper.WindowHeight - 1;
int stationsPerPage = endPos - startPos;
int max = Common.cachedInfos.Select((_, idx) => idx).Max((idx) => $" {idx + 1}) ".Length);
for (int i = 0; i < Common.cachedInfos.Count; i++)
Expand Down

0 comments on commit 3d5839d

Please sign in to comment.