1use crate::theme::theme;
2use gpui2::style::StyleHelpers;
3use gpui2::{elements::div, IntoElement};
4use gpui2::{Element, ViewContext};
5
6#[derive(Element)]
7pub struct Indicator {
8 player: usize,
9}
10
11pub fn indicator() -> Indicator {
12 Indicator { player: 0 }
13}
14
15impl Indicator {
16 pub fn player(mut self, player: usize) -> Self {
17 self.player = player;
18 self
19 }
20
21 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
22 let theme = theme(cx);
23 let player_color = theme.players[self.player].cursor;
24
25 div()
26 .w_4()
27 .h_1()
28 .rounded_bl_sm()
29 .rounded_br_sm()
30 .fill(player_color)
31 }
32}