Skip to content
Repos

DevPlaceApp

C++ 841 B22 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-social 13 (MessageBubbleView). Bubble with markdown, attachments, relative time and read checkmarks.
#include "model/Message.hpp"
#include "screens/components/QuoteComposer.hpp"
#include "ui/Views.hpp"

namespace dp {

// Row of one message: the bubble hugs its content up to `maxBubbleWidth`, own messages right aligned.
ui::ViewPtr MessageBubbleView(const Message& message, float maxBubbleWidth, QuoteComposer quote = {});

// Gradient stops of the bubble body (top, bottom colors) for the current appearance. Exposed for tests.
struct BubbleGradient {
  ui::Color top;
  ui::Color bottom;
  static BubbleGradient forMessage(bool isMine, bool dark);
};

// `mix(with:by:)`: linear blend of each sRGB channel toward `other`.
ui::Color mixColor(ui::Color base, ui::Color other, float fraction);

}  // namespace dp
37.3ms