// This example uses the screen sharing API to retrieve the contents of a tab,
// screen or window and feed that back into Echo. You can even feed the contents
// of Echo itself in this way, creating interesting feedback effects.
//
// NOTE: The output displayed in this example is restricted to the grid, but
// the editor will soon have support for fragment shaders to get around this
// constraint!
//
// To get started, you need to explicitly enable screen sharing
// by toggling it: [x](#screen)
import echo::{Context, Cell};
fn map_cell(i: Cell, ctx: Context) -> Cell {
let screen_color = echo::screen::get_color(i.sp * 0.5 + 0.5);
var o = i;
o.bg = screen_color;
return echo::map_cell_selection(o, i, ctx);
}